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.
- An atomically reference counted shared pointer
- A “borrowed
Arc”. This is a pointer to a T that is known to have been allocated within an
- ArcInner 🔒The object allocated by an Arc
- A tagged union that can represent
Arc<B>while only consuming a single word. The type is also
NonNull, and thus can be stored in an Option without increasing size.
- Structure to allow Arc-managing some fixed-sized data and a variably-sized slice in a single allocation.
- Header data with an inline length. Consumers that use HeaderWithLength as the Header type in HeaderSlice can take advantage of ThinArc.
- A “thin”
Arccontaining dynamically sized data
Arcthat is known to be uniquely owned
- This represents a borrow of an
- A soft limit on the amount of references that may be made to an
- Special refcount value that means the data is not reference counted, and that the
Arcis really acting as a read-only static reference.
- Computes the offset of the data field within ArcInner.