Index: Cargo.toml ================================================================== --- Cargo.toml +++ Cargo.toml @@ -1,8 +1,8 @@ [package] name = "ump-ng" -version = "0.2.0" +version = "0.2.1" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "concurrency", "asynchronous" ] keywords = [ "channel", "threads", "sync", "message-passing" ] @@ -35,5 +35,11 @@ harness = false [package.metadata.docs.rs] rustdoc-args = ["--generate-link-to-definition"] +[lints.clippy] +all = { level = "deny", priority = -1 } +pedantic = { level = "warn", priority = -1 } +nursery = { level = "warn", priority = -1 } +cargo = { level = "warn", priority = -1 } + Index: bacon.toml ================================================================== --- bacon.toml +++ bacon.toml @@ -7,11 +7,11 @@ # For information about clippy lints, see: # https://github.com/rust-lang/rust-clippy/blob/master/README.md #default_job = "check" -default_job = "clippy-all-pedantic" +default_job = "clippy-all" [jobs.check] command = ["cargo", "check", "--color", "always"] need_stdout = false @@ -44,35 +44,10 @@ command = [ "cargo", "clippy", "--all-targets", "--color", "always", ] -need_stdout = false - -[jobs.clippy-pedantic] -command = [ - "cargo", "clippy", - "--color", "always", - "--", - "-Wclippy::all", - "-Wclippy::pedantic", - "-Wclippy::nursery", - "-Wclippy::cargo" -] -need_stdout = false - -[jobs.clippy-all-pedantic] -command = [ - "cargo", "clippy", - "--all-targets", - "--color", "always", - "--", - "-Wclippy::all", - "-Wclippy::pedantic", - "-Wclippy::nursery", - "-Wclippy::cargo" -] need_stdout = false # This job lets you run # - all tests: bacon test # - a specific test: bacon test -- config::test_default_files Index: src/client.rs ================================================================== --- src/client.rs +++ src/client.rs @@ -162,10 +162,16 @@ /// Create a weak `Client` reference. #[must_use] pub fn weak(&self) -> Weak
{ Weak(self.0.weak()) } + + /// Create a special-purpose client that can only perform post operations. + #[must_use] + pub fn postclient(&self) -> Post
{ + Post(self.clone()) + } } impl
Clone for Client
{
/// Clone a client.
///
@@ -234,6 +240,29 @@
pub fn upgrade(&self) -> Option (Client );
+
+impl Post
+where
+ P: 'static + Send,
+ S: 'static + Send,
+ R: 'static + Send,
+ E: 'static + Send
+{
+ /// Transmit a uni-directional message to the server end-point.
+ ///
+ /// # Errors
+ /// [`Error::ServerDisappeared`] means the [`Server`](super::Server)
+ /// end-point has been dropped.
+ pub fn post(&self, msg: P) -> Result<(), Error