Expand description
Fork of Arc for Servo. This has the following advantages over std::sync::Arc:
- We don’t waste storage on the weak reference count.
- We don’t do extra RMU operations to handle the possibility of weak references.
- We can experiment with arena allocation (todo).
- We can add methods to support our custom use cases 1.
- We have support for dynamically-sized types (see from_header_and_iter).
- We have support for thin arcs to unsized types (see ThinArc).
- We have support for references to static data, which don’t do any refcounting.
Structs§
- Arc
- An atomically reference counted shared pointer
- ArcBorrow
- A “borrowed
Arc
”. This is a pointer to a T that is known to have been allocated within anArc
. - ArcInner 🔒
- The object allocated by an Arc
- ArcUnion
- A tagged union that can represent
Arc<A>
orArc<B>
while only consuming a single word. The type is alsoNonNull
, and thus can be stored in an Option without increasing size. - Header
Slice - Structure to allow Arc-managing some fixed-sized data and a variably-sized slice in a single allocation.
- Unique
Arc - An
Arc
that is known to be uniquely owned
Enums§
- ArcUnion
Borrow - This represents a borrow of an
ArcUnion
.
Constants§
- MAX_
REFCOUNT 🔒 - A soft limit on the amount of references that may be made to an
Arc
. - STATIC_
REFCOUNT 🔒 - Special refcount value that means the data is not reference counted,
and that the
Arc
is really acting as a read-only static reference.
Functions§
- data_
offset 🔒 - Computes the offset of the data field within ArcInner.
Type Aliases§
- ThinArc
- This is functionally equivalent to Arc<(H, [T])>
- Thin
ArcUnion - See
ArcUnion
. This is a version that works forThinArc
s.