Expand description

Rc and Option equivalents that facilitate sending data between threads.

This crate provides two types:

  • SendRc<T>, a single-threaded reference-counted pointer like Rc that is Send if T is Send.
  • SendOption<T>, a container like Option that is Send even if T is not Send.

Both types rely on run-time checks to enforce Rust’s safety guarantees. SendRc requires the pointers to be disabled before being sent to a different thread, and re-enabled after. SendOption requires the option to be set to None before being sent to another thread, and then to be explicitly marked as sent.

SendRc is designed for constructing single-threaded hierarchies that support data sharing and interior mutability (Cell and RefCell), and which needs to be transferred en masse to a new thread. Rc doesn’t allow that because it is not Send, and Arc doesn’t allow that because it requires T: Sync.

SendOption is designed for optional non-Send fields in otherwise Send types.

Crate optional features

  • deepsize - implement the traits provided by the deepsize crate.

Structs

Handle for enabling the SendRcs after they are sent to another thread.

Handle for disabling the SendRcs before they are sent to another thread.

Like Option<T>, but Send even if T is not Send.

Reference-counting pointer like Rc<T>, but which is Send if T is Send.