#weak-references #reference-counting #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)

15 releases

Uses old Rust 2015

0.1.14 Oct 7, 2024
0.1.13 Jun 17, 2024
0.1.12 May 29, 2024
0.1.11 Nov 29, 2023
0.1.0 Dec 5, 2018

#12 in Concurrency

Download history 411075/week @ 2024-08-24 375335/week @ 2024-08-31 429092/week @ 2024-09-07 378374/week @ 2024-09-14 439398/week @ 2024-09-21 457746/week @ 2024-09-28 494999/week @ 2024-10-05 472719/week @ 2024-10-12 490374/week @ 2024-10-19 507359/week @ 2024-10-26 486507/week @ 2024-11-02 493795/week @ 2024-11-09 495361/week @ 2024-11-16 425014/week @ 2024-11-23 484545/week @ 2024-11-30 499662/week @ 2024-12-07

1,993,536 downloads per month
Used in 993 crates (52 directly)

MIT/Apache

105KB
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

~110–390KB