Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 119 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[workspace]
resolver = "2"
members = [
"fuzzpaint",
"fuzzpaint", "fuzzpaint-collections", "fuzzpaint-connection",
"fuzzpaint-core"
]
, "fuzzpaint-io", "fuzzpaint-render", "fuzzpaint-types", "fuzzpaint-ui"]

[profile.profiling]
inherits = "release"
Expand Down
7 changes: 7 additions & 0 deletions fuzzpaint-collections/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "fuzzpaint-collections"
version = "0.1.0"
edition = "2024"

[dependencies]
fuzzpaint-types = { path = "../fuzzpaint-types" }
14 changes: 14 additions & 0 deletions fuzzpaint-collections/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
33 changes: 33 additions & 0 deletions fuzzpaint-connection/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "fuzzpaint-connection"
version = "0.1.0"
edition = "2024"

[dependencies]
fuzzpaint-collections = { path = "../fuzzpaint-collections" }
fuzzpaint-types = { path = "../fuzzpaint-types" }
bitcode = "0.6.9"
log = "0.4.29"
# Tokio is smoller than smol (probably cuz more eyes on it to optimize)
# It has a worse (more-implicit, panick-y) API tho :V
# Thas okay because we aggressively keep it compartmentalized.
tokio = { version = "1.49.0", optional = true }

[features]
default = ["client", "server", "tcp", "channel"]
client = []
server = []

# TCP-based connection.
tcp = ["dep:tokio", "tokio/net", "tokio/io-util"]

# A channel-based connection for a server and client within the same process.
channel = ["dep:tokio", "tokio/sync"]

# An interprocess-channel-based connection, using unidirectional shared mem to
# share blobs in an insulated manner.
# ipc-shm = []

[dev-dependencies]
# Needs a runtime and `join` for some tests.
tokio = { version = "1.49.0", features = ["rt", "macros"] }
22 changes: 22 additions & 0 deletions fuzzpaint-connection/src/channel/client.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pub struct Client {
pub(super) channel: super::BidiBitcodeChannel,
}
impl crate::client::Connection for Client {
type Error = super::ConnectionError;
/// Cancel-safe.
async fn send(
&mut self,
message: &crate::client_msg::Message<'_>,
) -> Result<&mut Self, Self::Error> {
self.channel.send(message).await?;
Ok(self)
}
/// Cancel-safe.
async fn flush(&mut self) -> Result<&mut Self, Self::Error> {
Ok(self)
}
/// Cancel-safe.
async fn recv(&mut self) -> Result<crate::server_msg::Message<'_>, Self::Error> {
self.channel.recv().await
}
}
Loading