Crate servo_arc [] [src]

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).

Structs

Arc
ArcBorrow

A "borrowed Arc". This is a pointer to a T that is known to have been allocated within an Arc.

HeaderSlice

Structure to allow Arc-managing some fixed-sized data and a variably-sized slice in a single allocation.

HeaderWithLength

Header data with an inline length. Consumers that use HeaderWithLength as the Header type in HeaderSlice can take advantage of ThinArc.

NonZeroPtrMut

Wrapper type for pointers to get the non-zero optimization. When NonZero/Shared/Unique are stabilized, we should just use Shared here to get the same effect. Gankro is working on this in 1.

RawOffsetArc

An Arc, except it holds a pointer to the T instead of to the entire ArcInner.

ThinArc
UniqueArc

An Arc that is known to be uniquely owned