#arc #ffi #sync #data-structure

triomphe

A fork of std::sync::Arc with some extra functionality and without weak references (originally servo_arc)

3 releases

Uses old Rust 2015

0.1.2 Jan 10, 2021
0.1.1 May 20, 2019
0.1.0 Dec 5, 2018

#52 in Concurrency

Download history 104/week @ 2020-10-02 208/week @ 2020-10-09 93/week @ 2020-10-16 49/week @ 2020-10-23 72/week @ 2020-10-30 118/week @ 2020-11-06 28/week @ 2020-11-13 35/week @ 2020-11-20 56/week @ 2020-11-27 133/week @ 2020-12-04 88/week @ 2020-12-11 53/week @ 2020-12-18 59/week @ 2020-12-25 24/week @ 2021-01-01 192/week @ 2021-01-08 1565/week @ 2021-01-15

320 downloads per month
Used in 44 crates (via sixtyfps-corelib)

MIT/Apache

46KB
874 lines

Triomphe

Fork of Arc. This has the following advantages over std::sync::Arc:

  • triomphe::Arc doesn't support weak references: we save space by excluding the weak reference count, and we don't do extra read-modify-update operations to handle the possibility of weak references.
  • triomphe::UniqueArc allows one to construct a temporarily-mutable Arc which can be converted to a regular triomphe::Arc later
  • triomphe::OffsetArc can be used transparently from C++ code and is compatible with (and can be converted to/from) triomphe::Arc
  • triomphe::ArcBorrow is functionally similar to &triomphe::Arc<T>, however in memory it's simply &T. This makes it more flexible for FFI; the source of the borrow need not be an Arc pinned on the stack (and can instead be a pointer from C++, or an OffsetArc). Additionally, this helps avoid pointer-chasing.
  • triomphe::Arc has can be constructed for dynamically-sized types via from_header_and_iter
  • triomphe::ThinArc provides thin-pointer Arcs to dynamically sized types
  • triomphe::ArcUnion is union of two triomphe:Arcs which fits inside one word of memory

This crate is a version of servo_arc meant for general community use.

Dependencies

~195–310KB