Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From ump-server-0.4.0 To trunk
2024-10-07
| ||
02:13 | Allow handler builders to return an application-defined context. check-in: 2991f2a6fa user: jan tags: builder-context | |
2024-09-26
| ||
11:29 | Enable all features for clippy jobs in bacon.toml. Leaf check-in: ad972bd452 user: jan tags: trunk | |
11:25 | Move clippy settings to Cargo.toml. check-in: 72b03a9f48 user: jan tags: trunk | |
2024-09-10
| ||
18:09 | Hardcode all features for pedantic clippy in bacon config. check-in: 09c247864d user: jan tags: trunk | |
01:14 | Release maintenance. check-in: ea36f2935c user: jan tags: trunk, ump-server-0.4.0 | |
01:09 | Update ump to 0.13.0. clippy fixes. check-in: 9cea401a86 user: jan tags: trunk | |
Changes to Cargo.toml.
︙ | ︙ | |||
20 21 22 23 24 25 26 | [features] default = ["tokio"] tokio = ["dep:tokio", "dep:async-trait"] tracing = ["dep:tracing"] watchdog = ["dep:parking_lot"] [dependencies] | | > > > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | [features] default = ["tokio"] tokio = ["dep:tokio", "dep:async-trait"] tracing = ["dep:tracing"] watchdog = ["dep:parking_lot"] [dependencies] async-trait = { version = "0.1.83", optional = true } parking_lot = { version = "0.12.3", optional = true } tokio = { version = "1.40.0", features = ["rt"], optional = true } tracing = { version = "0.1.40", optional = true } ump = { version = "0.13.0" } [dev-dependencies] tokio-test = { version = "0.4.4" } [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs", "--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 } |
Changes to bacon.toml.
1 2 3 4 5 6 7 8 9 10 11 | # This is a configuration file for the bacon tool # # Bacon repository: https://github.com/Canop/bacon # Complete help on configuration: https://dystroy.org/bacon/config/ # You can also check bacon's own bacon.toml file # as an example: https://github.com/Canop/bacon/blob/main/bacon.toml # For information about clippy lints, see: # https://github.com/rust-lang/rust-clippy/blob/master/README.md #default_job = "check" | | > | < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # This is a configuration file for the bacon tool # # Bacon repository: https://github.com/Canop/bacon # Complete help on configuration: https://dystroy.org/bacon/config/ # You can also check bacon's own bacon.toml file # as an example: https://github.com/Canop/bacon/blob/main/bacon.toml # For information about clippy lints, see: # https://github.com/rust-lang/rust-clippy/blob/master/README.md #default_job = "check" default_job = "clippy-all" [jobs.check] command = ["cargo", "check", "--color", "always"] need_stdout = false [jobs.check-all] command = ["cargo", "check", "--all-targets", "--color", "always"] need_stdout = false # Run clippy on the default target [jobs.clippy] command = [ "cargo", "clippy", "--all-features", "--color", "always", ] need_stdout = false # Run clippy on all targets # To disable some lints, you may change the job this way: # [jobs.clippy-all] # command = [ # "cargo", "clippy", # "--all-targets", # "--color", "always", # "--", # "-A", "clippy::bool_to_int_with_if", # "-A", "clippy::collapsible_if", # "-A", "clippy::derive_partial_eq_without_eq", # ] # need_stdout = false [jobs.clippy-all] command = [ "cargo", "clippy", "--all-features", "--all-targets", "--color", "always", ] need_stdout = false # This job lets you run # - all tests: bacon test # - a specific test: bacon test -- config::test_default_files # - the tests of a package: bacon test -- -- -p config |
︙ | ︙ |
Changes to src/lib.rs.
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | //! has been created so it can be passed a reference to the client end-point. //! //! If the dispatch loop should terminate once all the application's client //! end-points have been dropped, then the handler can store a [`WeakClient`] //! instead (as storing a cloned [`Client`] object will preventing the dispatch //! loop from terminating due to all clients being lost). The examples in the //! [`task`] and [`thread`] modules illustrate how to do this. #![cfg_attr(docsrs, feature(doc_cfg))] #[cfg(feature = "watchdog")] mod wdog; #[cfg(feature = "tokio")] | > > > > > > > > > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | //! has been created so it can be passed a reference to the client end-point. //! //! If the dispatch loop should terminate once all the application's client //! end-points have been dropped, then the handler can store a [`WeakClient`] //! instead (as storing a cloned [`Client`] object will preventing the dispatch //! loop from terminating due to all clients being lost). The examples in the //! [`task`] and [`thread`] modules illustrate how to do this. //! //! ## Generics //! When a new handler is created, it needs to define the generic type //! parameters: //! //! - `S` - sent from the client to the server handler when making requests. //! - `R` - replies sent back to the client from the server handler using. //! [`ReplyContext::reply()`]. //! - `E` - errors returned from server handler to requestor through //! [`ReplyContext::fail()`] (and also returned by the server handler //! construction closure). //! - `RV` - return type the server handler can use to pass termination data //! back to the dispatch loop creator once it terminates. #![cfg_attr(docsrs, feature(doc_cfg))] #[cfg(feature = "watchdog")] mod wdog; #[cfg(feature = "tokio")] |
︙ | ︙ |
Changes to src/task.rs.
︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | use tokio::task::{self, JoinHandle}; use async_trait::async_trait; use super::{channel, Client, ReplyContext}; /// Message processing trait for an async handler. #[async_trait] pub trait Handler<S, R, E, RV> { /// Optional initialization callback. /// /// This is called on the dispatcher task before the main message dispatch /// loop is entered. #[allow(unused_variables)] | > > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | use tokio::task::{self, JoinHandle}; use async_trait::async_trait; use super::{channel, Client, ReplyContext}; /// Message processing trait for an async handler. /// /// See top module documentation for more information about [application /// message handlers](crate#application-message-handlers). #[async_trait] pub trait Handler<S, R, E, RV> { /// Optional initialization callback. /// /// This is called on the dispatcher task before the main message dispatch /// loop is entered. #[allow(unused_variables)] |
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 | fn term(&mut self, rv: Option<RV>) -> Option<RV> { rv } } /// Run a task which will process incoming messages from an ump server /// end-point. /// /// See top module's documentation for an overview of the [dispatch | > > | > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | fn term(&mut self, rv: Option<RV>) -> Option<RV> { rv } } /// Run a task which will process incoming messages from an ump server /// end-point. /// /// `hbldr` is a closure that should spawn a [`Handler`]. /// /// See top module's documentation for an overview of the [dispatch /// loop](crate#dispatch-loop) and what the [generic /// parameters](crate#generics) are for. /// /// # Errors /// An application-defined error `E` is returned if the dispatch loop is /// terminated by a handler returning `ControlFlow::Break(E)`. #[allow(clippy::type_complexity)] pub fn spawn<S, R, E, RV, F>( hbldr: impl FnOnce(&Client<S, R, E>) -> Result<F, E> |
︙ | ︙ |
Changes to src/thread.rs.
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | //! ``` use std::{ops::ControlFlow, thread}; use super::{channel, Client, ReplyContext}; /// Message processing trait for a threaded handler. pub trait Handler<S, R, E, RV> { /// Optional initialization callback. /// /// This is called on the dispatcher thread before the main message /// dispatch loop is entered. #[allow(unused_variables)] fn init(&mut self, weak_client: ump::WeakClient<S, R, E>) {} | > > > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | //! ``` use std::{ops::ControlFlow, thread}; use super::{channel, Client, ReplyContext}; /// Message processing trait for a threaded handler. /// /// See top module documentation for more information about [application /// message handlers](crate#application-message-handlers). pub trait Handler<S, R, E, RV> { /// Optional initialization callback. /// /// This is called on the dispatcher thread before the main message /// dispatch loop is entered. #[allow(unused_variables)] fn init(&mut self, weak_client: ump::WeakClient<S, R, E>) {} |
︙ | ︙ | |||
96 97 98 99 100 101 102 103 104 | fn term(&mut self, rv: Option<RV>) -> Option<RV> { rv } } /// Run a thread which will process incoming messages from an ump server /// end-point. /// /// See top module's documentation for an overview of the [dispatch | > > | > | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | fn term(&mut self, rv: Option<RV>) -> Option<RV> { rv } } /// Run a thread which will process incoming messages from an ump server /// end-point. /// /// `hbldr` is a closure that should spawn a [`Handler`]. /// /// See top module's documentation for an overview of the [dispatch /// loop](crate#dispatch-loop) and what the [generic /// parameters](crate#generics) are for. /// /// # Errors /// An application-defined error `E` is returned if the dispatch loop is /// terminated by a handler returning `ControlFlow::Break(E)`. #[allow(clippy::type_complexity)] pub fn spawn<S, R, E, RV, F>( hbldr: impl FnOnce(&Client<S, R, E>) -> Result<F, E> |
︙ | ︙ |