pub struct AnyValue<'gc, M: 'gc>(/* private fields */);Expand description
Garbage collected Any type that can be downcast.
Implementations§
Source§impl<'gc, M> AnyValue<'gc, M>
impl<'gc, M> AnyValue<'gc, M>
pub fn new<R>(mc: &Mutation<'gc>, metadata: M, data: Root<'gc, R>) -> Self
pub fn metadata(&self) -> &'gc M
pub fn write_metadata(&self, mc: &Mutation<'gc>) -> &'gc Write<M>
pub fn as_ptr(&self) -> *const ()
pub fn type_id(&self) -> TypeId
pub fn is<R>(&self) -> boolwhere
R: for<'b> Rootable<'b>,
pub fn downcast<R>(&self) -> Option<&'gc Root<'gc, R>>where
R: for<'b> Rootable<'b>,
pub fn downcast_write<R>(
&self,
mc: &Mutation<'gc>,
) -> Option<&'gc Write<Root<'gc, R>>>where
R: for<'b> Rootable<'b>,
Trait Implementations§
Source§impl<'gc, M> Collect for AnyValue<'gc, M>where
M: Collect + 'gc,
impl<'gc, M> Collect for AnyValue<'gc, M>where
M: Collect + 'gc,
Source§fn needs_trace() -> bool
fn needs_trace() -> bool
As an optimization, if this type can never hold a
Gc pointer and trace is unnecessary
to call, you may implement this method and return false. The default implementation returns
true, signaling that Collect::trace must be called.Source§fn trace(&self, cc: &Collection)
fn trace(&self, cc: &Collection)
Must call
Collect::trace on all held Gc pointers. If this type holds inner types that
implement Collect, a valid implementation would simply call Collect::trace on all the
held values to ensure this.impl<'gc, M> Copy for AnyValue<'gc, M>
Auto Trait Implementations§
impl<'gc, M> Freeze for AnyValue<'gc, M>
impl<'gc, M> !RefUnwindSafe for AnyValue<'gc, M>
impl<'gc, M> !Send for AnyValue<'gc, M>
impl<'gc, M> !Sync for AnyValue<'gc, M>
impl<'gc, M> Unpin for AnyValue<'gc, M>
impl<'gc, M> UnsafeUnpin for AnyValue<'gc, M>
impl<'gc, M> !UnwindSafe for AnyValue<'gc, M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more