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> { self.0.upgrade().map(|x| Client(x)) } } + +/// Special purpose client end-point that can only issue `Post` requests. +#[derive(Clone)] +#[repr(transparent)] +pub struct Post(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> { + self.0.post(msg) + } +} + // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 : Index: src/lib.rs ================================================================== --- src/lib.rs +++ src/lib.rs @@ -122,11 +122,11 @@ mod server; pub use err::Error; pub use crate::{ - client::{Client, WaitReply, Weak as WeakClient}, + client::{Client, Post as PostClient, WaitReply, Weak as WeakClient}, rctx::ReplyContext, server::{MsgType, Server} }; /// Create a pair of linked [`Server`] and [`Client`] objects. Index: www/changelog.md ================================================================== --- www/changelog.md +++ www/changelog.md @@ -2,13 +2,35 @@ ⚠️ indicates a breaking change. ## [Unreleased] -[Details](/vdiff?from=ump-ng-0.1.0&to=trunk) +[Details](/vdiff?from=ump-ng-0.2.1&to=trunk) + +### Added + +### Changed + +### Removed + +--- + +## [0.2.1] - 2024-09-26 + +[Details](/vdiff?from=ump-ng-0.2.0&to=ump-ng-0.2.1) ### Added + +- Add `Client::postonly()` for spawning `PostClient` objects. +- `PostClient` is a special purpose `Client` that can only issue _post_ + operations. + +--- + +## [0.2.0] - 2024-09-10 + +[Details](/vdiff?from=ump-ng-0.1.0&to=ump-ng-0.2.0 ) ### Changed - Add some `Send` bounds to make `Future`s `Send`. - Update to `swctx` to `0.3.0`, allowing `ReplyContext` to detect if the