Trait GcCell

Source
pub trait GcCell: Any {
    // Provided methods
    fn compute_size(&self) -> usize { ... }
    fn type_name(&self) -> &'static str { ... }
}
Expand description

GcCell is a type that can be allocated in GC heap.

Provided Methods§

Source

fn compute_size(&self) -> usize

Used when object has dynamic size i.e arrays

Source

fn type_name(&self) -> &'static str

Implementations§

Source§

impl dyn GcCell

Source

pub fn is<T: GcCell>(&self) -> bool

Returns true if the boxed type is the same as T

Source

pub fn downcast_ref<T: GcCell>(&self) -> Option<&T>

Returns some reference to the boxed value if it is of type T, or None if it isn’t.

Source

pub unsafe fn downcast_ref_unchecked<T: GcCell>(&self) -> &T

Returns a reference to the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

Source

pub fn downcast_mut<T: GcCell>(&mut self) -> Option<&mut T>

Returns some mutable reference to the boxed value if it is of type T, or None if it isn’t.

Source

pub unsafe fn downcast_mut_unchecked<T: GcCell>(&mut self) -> &mut T

Returns a mutable reference to the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

Source§

impl dyn GcCell

Source

pub fn downcast<T: GcCell>(self: Box<Self>) -> Result<Box<T>, Box<Self>>

Returns the boxed value if it is of type T, or Err(Self) if it isn’t.

Source

pub unsafe fn downcast_unchecked<T: GcCell>(self: Box<Self>) -> Box<T>

Returns the boxed value, blindly assuming it to be of type T. If you are not absolutely certain of T, you must not call this.

Implementations on Foreign Types§

Source§

impl GcCell for bool

Source§

impl GcCell for f32

Source§

impl GcCell for f64

Source§

impl GcCell for i8

Source§

impl GcCell for i16

Source§

impl GcCell for i32

Source§

impl GcCell for i64

Source§

impl GcCell for i128

Source§

impl GcCell for u8

Source§

impl GcCell for u16

Source§

impl GcCell for u32

Source§

impl GcCell for u64

Source§

impl GcCell for u128

Source§

impl GcCell for String

Source§

impl GcCell for File

Source§

impl<K: GcCell, V: GcCell> GcCell for HashMap<K, V>

Source§

impl<T: GcCell> GcCell for Option<T>

Source§

impl<T: GcCell> GcCell for Vec<T>

Implementors§