Struct zerogc::vec::GcVec[][src]

pub struct GcVec<'gc, T: GcSafe, Ctx: GcSimpleAlloc> {
    pub context: &'gc Ctx,
    pub raw: GcRawVec<'gc, T, Ctx::Id>,
}
Expand description

A version of Vec for use with garbage collectors.

This is simply a thin wrapper around [RawGcVec] that also contains a reference to the owning [GcContext].

Fields

context: &'gc Ctx

A reference to the owning GcContext

raw: GcRawVec<'gc, T, Ctx::Id>

The underlying [RawGcVec], which actually manages the memory

Implementations

Convert this vector into its underlying GcRawVec

Reserve enough capacity for the specified number of additional elements.

Extend the vector with elements copied from the specified slice

Push the specified value onto the vector

Methods from Deref<Target = GcRawVec<'gc, T, Ctx::Id>>

View this [RawGcVec] as a GcVec for the duration of the specified closure, with an implicit reference to the specified [GcContext]

View this [RawGcVec] as a GcVec for the duration of the specified closure

The length of this vector

The capacity of this vector.

Clear the vector, setting its length to zero

Push a value onto this vector, returning an error if there is insufficient space.

Get the raw representation of this vector as a GcVecRepr

Safety

The user must not violate the invariants of the repr.

Get a mutable reference to the raw represnetation of this vector

Safety

The user must preserve the validity of the underlying representation.

Interpret this vector as a slice

Because the length may change, this is bound to the lifetime of the current value.

Give a pointer to the underlying slice of memory

Safety

The returned memory must not be mutated.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Whether this type needs to be traced by the garbage collector. Read more

If this type needs a destructor run. Read more

Visit each field in this type Read more

Visit this object, assuming its already inside a GC pointer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.