Skip to content

Commit c5c92b4

Browse files
authored
update readme
1 parent 7663baf commit c5c92b4

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

README.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
SendWrapper
22
===========
33

4-
This [Rust] library implements a wrapper type called `SendWrapper` which allows you to move around non-[`Send`] types
4+
This [Rust] crate implements a wrapper type called `SendWrapper` which allows you to move around non-[`Send`] types
55
between threads, as long as you access the contained value only from within the original thread. You also have to
66
make sure that the wrapper is dropped from within the original thread. If any of these constraints is violated,
77
a panic occurs.
88

9-
The idea for this library was born in the context of a [`GTK+`]/[`gtk-rs`]-based application. [`GTK+`] applications
9+
The idea for this crate was born in the context of a [`GTK+`]/[`gtk-rs`]-based application. [`GTK+`] applications
1010
are strictly single-threaded. It is not allowed to call any [`GTK+`] method from a thread different to the main
1111
thread. Consequently, all [`gtk-rs`] structs are non-[`Send`].
1212

1313
Sometimes you still want to do some work in background. It is possible to enqueue [`GTK+`] calls from there to be
1414
executed in the main thread [using `Glib`]. This way you can know, that the [`gtk-rs`] structs involved are only
15-
accessed in the main thread and will also be dropped there. This library makes it possible that [`gtk-rs`] structs
16-
can leave the main thread at all, like required in the given
17-
18-
[Documentation](https://docs.rs/send_wrapper)
19-
20-
21-
15+
accessed in the main thread and will also be dropped there. This crate makes it possible for [`gtk-rs`] structs
16+
to leave the main thread.
2217

2318
# Examples
2419

@@ -68,14 +63,14 @@ let value = wrapped_value.deref();
6863
```
6964

7065

71-
## Using with `Future`
66+
## Wrapping `Future`s and `Stream`s
7267

73-
To use `SendWrapper` on `Future`s, you should enable `futures` Cargo feature first:
68+
To use `SendWrapper` on `Future`s or `Stream`s, you should enable the Cargo feature `futures` first:
7469
```toml
7570
send_wrapper = { version = "0.5", features = ["futures"] }
7671
```
7772

78-
And then, just wrap your `Future` (or `Stream`):
73+
Then, you can transparently wrap your `Future` or `Stream`:
7974
```rust
8075
use futures::{executor, future::{self, BoxFuture}};
8176
use send_wrapper::SendWrapper;
@@ -97,7 +92,9 @@ let t = thread::spawn(move || {
9792
```
9893

9994

95+
# Changelog
10096

97+
See [CHANGELOG.md](CHANGELOG.md)
10198

10299
# License
103100

@@ -106,9 +103,6 @@ let t = thread::spawn(move || {
106103
See LICENSE-APACHE, and LICENSE-MIT for details.
107104

108105

109-
110-
111-
112106
[Rust]: https://www.rust-lang.org
113107
[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
114108
[`gtk-rs`]: http://gtk-rs.org/

0 commit comments

Comments
 (0)