ump-ng

Check-in Differences
Login

Check-in Differences

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Difference From ump-ng-0.2.0 To ump-ng-0.2.1

2024-09-26
13:15
Prototyping Server::proc_loop() Leaf check-in: a6904509b7 user: jan tags: proc_loop
12:18
Fixups. Leaf check-in: d133e091d2 user: jan tags: trunk, ump-ng-0.2.1
12:13
Add Clone to PostClient. Release maintenance. check-in: 086f702df8 user: jan tags: trunk
2024-09-12
20:25
Move clippy config from bacon.toml to Cargo.toml. check-in: e3dd8a1bd0 user: jan tags: trunk
2024-09-10
00:30
Rename `MsgType::Put` to `MsgType::Post`. Dependency maintenance. check-in: 6f4b9d43d1 user: jan tags: trunk, ump-ng-0.2.0
2024-09-09
20:59
Make use of updated swctx's ability to report when the waitctx has been dropped. Clippy fixups. check-in: a48d827d1a user: jan tags: trunk

Changes to Cargo.toml.

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







[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" ]
repository = "https://repos.qrnch.tech/pub/ump-ng"
description = "Micro message passing library for threads/tasks communication."
33
34
35
36
37
38
39






33
34
35
36
37
38
39
40
41
42
43
44
45







+
+
+
+
+
+
[[bench]]
name = "add_server"
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 }

Changes to bacon.toml.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19











-
+







# 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-pedantic"
default_job = "clippy-all"

[jobs.check]
command = ["cargo", "check", "--color", "always"]
need_stdout = false

[jobs.check-all]
command = ["cargo", "check", "--all-targets", "--color", "always"]
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
69
70
71
72
73
74
75
76
77
78
79
80
42
43
44
45
46
47
48

























49
50
51
52
53
54
55







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







# need_stdout = false
[jobs.clippy-all]
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
# - the tests of a package: bacon test -- -- -p config
[jobs.test]

Changes to src/client.rs.

160
161
162
163
164
165
166






167
168
169
170
171
172
173
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179







+
+
+
+
+
+







  }

  /// Create a weak `Client` reference.
  #[must_use]
  pub fn weak(&self) -> Weak<P, S, R, E> {
    Weak(self.0.weak())
  }

  /// Create a special-purpose client that can only perform post operations.
  #[must_use]
  pub fn postclient(&self) -> Post<P, S, R, E> {
    Post(self.clone())
  }
}

impl<P, S, R, E> Clone for Client<P, S, R, E> {
  /// Clone a client.
  ///
  /// When a client is cloned the new object will be linked to the same server,
  /// but in all other respects the clone is a completely independent client.
232
233
234
235
236
237
238























239
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

impl<P, S, R, E> Weak<P, S, R, E> {
  #[must_use]
  pub fn upgrade(&self) -> Option<Client<P, S, R, E>> {
    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<P, S, R, E>(Client<P, S, R, E>);

impl<P, S, R, E> Post<P, S, R, E>
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<E>> {
    self.0.post(msg)
  }
}

// vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :

Changes to src/lib.rs.

120
121
122
123
124
125
126
127

128
129
130
131
132
133
134
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134







-
+







mod err;
mod rctx;
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.
///
/// The [`Server`] object is used to wait for incoming messages from connected

Changes to www/changelog.md.

1
2
3
4
5
6
7

8
9






















10
11
12
13
14
15
16
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






-
+


+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







# Change Log

⚠️  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
  originating client has been dropped.
- ⚠️ Require `std::error::Error` bound on application-specific error `E` for