• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-1,095767

.cargo-checksum.jsonH A D03-May-202289 11

.gitignoreH A D22-Aug-201831 53

Cargo.tomlH A D01-Jan-1970936 2321

Cargo.toml.orig-cargoH A D22-Aug-2018412 1110

LICENSEH A D01-Jun-201811.1 KiB203169

README.mdH A D22-Aug-2018761 2519

README.md

1# Fragile
2
3This library provides wrapper types that permit sending non Send types to other
4threads and use runtime checks to ensure safety.
5
6It provides two types: `Fragile<T>` and `Sticky<T>` which are similar in nature but
7have different behaviors with regards to how destructors are executed.  The former
8will panic if the destructor is called in another thread, the latter will temporarily
9leak the object until the thread shuts down.
10
11```rust
12use std::thread;
13
14// creating and using a fragile object in the same thread works
15let val = Fragile::new(true);
16assert_eq!(*val.get(), true);
17assert!(val.try_get().is_ok());
18
19// once send to another thread it stops working
20thread::spawn(move || {
21    assert!(val.try_get().is_err());
22}).join()
23    .unwrap();
24```
25