Struct zerogc::vec::cell::GcVecCell [−][src]
pub struct GcVecCell<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> { /* fields omitted */ }
Expand description
A garbage collected vector, wrapped in a RefCell for interior mutability.
Essentially a Gc<RefCell<GcVec<'gc, T, Id>>>
. However,
this can’t be done directly because RefCell<T>
normally requires
T: NullTrace
(because of the possibility of write barriers).
Implementations
Immutably borrow the wrapped GcVec.
The returned borrow is dynamically tracked, and guarded by the returned core::cell::Ref object.
All immutable accesses through the IGcVec interface implicitly call this method (and thus carry the same risk of panics).
Panics
Panics if this vector has an outstanding mutable borrow.
Mutably (and exclusively) borrow the wrapped GcVec.
The returned borrow is dynamically tracked, and guarded by the returned core::cell::RefMut object.
All mutable accesses through the IGcVec interface implicitly call this method (and thus carry the same risk of panics).
Panics
Panics if this vector has any other outstanding borrows.
Immutably borrow a slice of this vector’s contents.
Implicitly calls GcVecCell::borrow, and caries the same risk of panics.
Mutably borrow a slice of this vector’s contents.
Implicitly calls GcVecCell::borrow_mut, and caries the same risk of panics.
See IGcVec::len
See IGcVec::set_len
See IGcVec::capacity
See IGcVec::as_ptr
See IGcVec::context
See IGcVec::replace
See IGcVec::set
See IGcVec::push
See IGcVec::pop
See IGcVec::reserve
See IGcVec::is_empty
See IGcVec::new_in
pub fn copy_from_slice(
src: &[T],
ctx: &'gc <Id as CollectorId>::Context
) -> Self where
T: Copy,
pub fn copy_from_slice(
src: &[T],
ctx: &'gc <Id as CollectorId>::Context
) -> Self where
T: Copy,
See IGcVec::from_vec
Trait Implementations
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<'gc, 'new_gc, T: GcSafe<'gc, Id>, Id: CollectorId> GcRebrand<'new_gc, Id> for GcVecCell<'gc, T, Id> where
Id: CollectorId,
T: GcRebrand<'new_gc, Id>,
T::Branded: GcSafe<'new_gc, Id>,
Id: CollectorId,
T::Branded: Sized,
impl<'gc, 'new_gc, T: GcSafe<'gc, Id>, Id: CollectorId> GcRebrand<'new_gc, Id> for GcVecCell<'gc, T, Id> where
Id: CollectorId,
T: GcRebrand<'new_gc, Id>,
T::Branded: GcSafe<'new_gc, Id>,
Id: CollectorId,
T::Branded: Sized,
impl<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> GcSafe<'gc, Id> for GcVecCell<'gc, T, Id> where
Id: CollectorId,
T: GcSafe<'gc, Id>,
impl<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> GcSafe<'gc, Id> for GcVecCell<'gc, T, Id> where
Id: CollectorId,
T: GcSafe<'gc, Id>,
impl<'gc, T: GcSafe<'gc, Id>, Id: SimpleAllocCollectorId> IGcVec<'gc, T> for GcVecCell<'gc, T, Id>
impl<'gc, T: GcSafe<'gc, Id>, Id: SimpleAllocCollectorId> IGcVec<'gc, T> for GcVecCell<'gc, T, Id>
type Id = Id
type Id = Id
The id of the collector
Allocate a new vector with the specified capacity, using the specified context. Read more
The total amount of space that is available without needing reallocation. Read more
Attempt to reallocate the vector in-place, without moving the underlying pointer. Read more
Copy the specified elements into a new vector, allocating it in the specified context Read more
fn copy_from_slice(
src: &[T],
ctx: &'gc <Self::Id as CollectorId>::Context
) -> Self where
T: Copy,
fn copy_from_slice(
src: &[T],
ctx: &'gc <Self::Id as CollectorId>::Context
) -> Self where
T: Copy,
Copy the specified elements into a new vector, allocating it in the specified context Read more
Allocate a new vector inside the specified context
Pop an element of the end of the vector,
returning None
if empty. Read more
Removes an element from the vector and returns it. Read more
Extend the vector with elements copied from the specified slice
Get the item at the specified index,
or None
if it is out of bounds. Read more
Replace the item at the specified index, returning the old value. Read more
Get a mutable pointer to the vector’s underlying data. Read more
Because vectors are associated with a GcContext,
they contain thread local data (and thus must be !Send
impl<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> TrustedDrop for GcVecCell<'gc, T, Id> where
T: TrustedDrop,
Auto Trait Implementations
impl<'gc, T, Id> !RefUnwindSafe for GcVecCell<'gc, T, Id>
impl<'gc, T, Id> !UnwindSafe for GcVecCell<'gc, T, Id>
Blanket Implementations
Mutably borrows from an owned value. Read more