#reference-counting #weak-references #arc #data-structures #sync #ffi

no-std triomphe

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

12 releases

Uses old Rust 2015

0.1.11 Nov 29, 2023
0.1.9 Jul 5, 2023
0.1.8 Sep 6, 2022
0.1.7 Jul 6, 2022
0.1.0 Dec 5, 2018

#14 in Concurrency

Download history 186471/week @ 2024-01-03 202771/week @ 2024-01-10 224016/week @ 2024-01-17 244943/week @ 2024-01-24 294659/week @ 2024-01-31 212665/week @ 2024-02-07 213794/week @ 2024-02-14 245240/week @ 2024-02-21 252013/week @ 2024-02-28 249405/week @ 2024-03-06 267191/week @ 2024-03-13 287196/week @ 2024-03-20 282190/week @ 2024-03-27 294731/week @ 2024-04-03 304737/week @ 2024-04-10 244880/week @ 2024-04-17

1,181,498 downloads per month
Used in 566 crates (42 directly)

MIT/Apache

94KB
2K SLoC

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

~120–420KB