pub struct M<'w, T>(pub &'w mut T);Expand description
A wrapper around a mutable reference to a value of type T.
This can be used to retrieve a mutable reference out of a ScriptValue::Reference corresponding to the type T.
Before downcasting the reference, it will claim write access to the object to ensure that the reference is valid.
However, the access is NOT released when the Mut is dropped. This is not unsafe but can lead to deadlocks if not released later.
The [ScriptFunction] calling mechanism will take care of releasing all accesses claimed during the function call.
Tuple Fields§
§0: &'w mut TTrait Implementations§
Source§impl<T> ArgMeta for M<'_, T>
impl<T> ArgMeta for M<'_, T>
Source§fn default_value() -> Option<ScriptValue>
fn default_value() -> Option<ScriptValue>
The default value for the argument. Used when the argument is not provided.
Source§impl<T: FromReflect> FromScript for M<'_, T>
impl<T: FromReflect> FromScript for M<'_, T>
Source§fn from_script(
value: ScriptValue,
world: WorldGuard<'_>,
) -> Result<Self::This<'_>, InteropError>
fn from_script( value: ScriptValue, world: WorldGuard<'_>, ) -> Result<Self::This<'_>, InteropError>
Construct a value of type
T from a ScriptValue.Source§impl<'a, T> GetTypeDependencies for M<'a, T>where
T: GetTypeRegistration,
impl<'a, T> GetTypeDependencies for M<'a, T>where
T: GetTypeRegistration,
Source§type Underlying = T
type Underlying = T
In the majority of the implementations, this will be
Self
However some types might be facades for other types, in which case this will be the underlying typeSource§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Registers the type dependencies of the implementing type with the given
TypeRegistry.Source§impl<T: Typed> TypedThrough for M<'_, T>
impl<T: Typed> TypedThrough for M<'_, T>
Source§fn through_type_info() -> ThroughTypeInfo
fn through_type_info() -> ThroughTypeInfo
Get the
ThroughTypeInfo for the type.Auto Trait Implementations§
impl<'w, T> !UnwindSafe for M<'w, T>
impl<'w, T> Freeze for M<'w, T>
impl<'w, T> RefUnwindSafe for M<'w, T>where
T: RefUnwindSafe,
impl<'w, T> Send for M<'w, T>where
T: Send,
impl<'w, T> Sync for M<'w, T>where
T: Sync,
impl<'w, T> Unpin for M<'w, T>
impl<'w, T> UnsafeUnpin for M<'w, T>
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
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoNamespace for Twhere
T: 'static + ?Sized,
impl<T> IntoNamespace for Twhere
T: 'static + ?Sized,
Source§fn into_namespace() -> Namespace
fn into_namespace() -> Namespace
Converts this type into a
NamespaceSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.