pub struct UserData<'gc>(/* private fields */);
Implementations§
Source§impl<'gc> UserData<'gc>
impl<'gc> UserData<'gc>
pub fn new<R>(mc: &Mutation<'gc>, val: Root<'gc, R>) -> Selfwhere
R: for<'a> Rootable<'a>,
pub fn new_static<R: 'static>(mc: &Mutation<'gc>, val: R) -> Self
pub fn from_inner(inner: Gc<'gc, UserDataInner<'gc>>) -> Self
pub fn into_inner(self) -> Gc<'gc, UserDataInner<'gc>>
pub fn is<R>(self) -> boolwhere
R: for<'a> Rootable<'a>,
pub fn is_static<R: 'static>(self) -> bool
pub fn downcast<R>(self) -> Result<&'gc Root<'gc, R>, BadUserDataType>where
R: for<'b> Rootable<'b>,
pub fn downcast_write<R>(
self,
mc: &Mutation<'gc>,
) -> Result<&'gc Write<Root<'gc, R>>, BadUserDataType>where
R: for<'b> Rootable<'b>,
pub fn downcast_static<R: 'static>(self) -> Result<&'gc R, BadUserDataType>
pub fn metatable(self) -> Option<Table<'gc>>
pub fn set_metatable( self, mc: &Mutation<'gc>, metatable: Option<Table<'gc>>, ) -> Option<Table<'gc>>
Trait Implementations§
Source§impl<'gc> Collect for UserData<'gc>
impl<'gc> Collect for UserData<'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.Source§impl<'a, 'gc> IntoValue<'gc> for &'a UserData<'gc>
impl<'a, 'gc> IntoValue<'gc> for &'a UserData<'gc>
fn into_value(self, ctx: Context<'gc>) -> Value<'gc>
Source§impl<'gc> IntoValue<'gc> for UserData<'gc>
impl<'gc> IntoValue<'gc> for UserData<'gc>
fn into_value(self, _: Context<'gc>) -> Value<'gc>
Source§impl<'gc> Stashable<'gc> for UserData<'gc>
impl<'gc> Stashable<'gc> for UserData<'gc>
type Stashed = StashedUserData
fn stash(self, roots: &DynamicRootSet<'gc>, mc: &Mutation<'gc>) -> Self::Stashed
impl<'gc> Copy for UserData<'gc>
impl<'gc> Eq for UserData<'gc>
Auto Trait Implementations§
impl<'gc> Freeze for UserData<'gc>
impl<'gc> !RefUnwindSafe for UserData<'gc>
impl<'gc> !Send for UserData<'gc>
impl<'gc> !Sync for UserData<'gc>
impl<'gc> Unpin for UserData<'gc>
impl<'gc> !UnwindSafe for UserData<'gc>
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