pub struct Borrow<'a, T>(/* private fields */);
Implementations§
source§impl<'gc, T> Borrow<'gc, T>
impl<'gc, T> Borrow<'gc, T>
pub fn new(value: &'gc T) -> Borrow<'gc, T::Value>where
T: CloneUnrooted,
pub fn from_static(value: T) -> Selfwhere
T: 'static,
pub fn map<U>(&self, f: impl FnOnce(&T) -> &U) -> Borrow<'gc, U::Value>where
U: CloneUnrooted,
pub unsafe fn map_unrooted<U>(self, f: impl FnOnce(T) -> U) -> Borrow<'gc, U>
pub unsafe fn unrooted(self) -> T
pub fn as_lifetime(&self) -> &'gc ()
Trait Implementations§
source§impl<T> CloneUnrooted for Borrow<'_, T>where
T: CloneUnrooted,
impl<T> CloneUnrooted for Borrow<'_, T>where
T: CloneUnrooted,
type Value = <T as CloneUnrooted>::Value
source§unsafe fn clone_unrooted(&self) -> Self::Value
unsafe fn clone_unrooted(&self) -> Self::Value
Creates a clone of the value that is not rooted. To ensure safety the value must be
forgotten or rooted before the next garbage collection
source§impl<'a, T> DataDef for Borrow<'a, T>
impl<'a, T> DataDef for Borrow<'a, T>
source§impl<'gc> From<Borrow<'gc, GcPtr<ClosureData>>> for Variants<'gc>
impl<'gc> From<Borrow<'gc, GcPtr<ClosureData>>> for Variants<'gc>
source§fn from(v: GcRef<'gc, ClosureData>) -> Self
fn from(v: GcRef<'gc, ClosureData>) -> Self
Converts to this type from the input type.
source§impl<'gc, T: ?Sized> From<Borrow<'gc, OwnedPtr<T>>> for GcRef<'gc, T>
impl<'gc, T: ?Sized> From<Borrow<'gc, OwnedPtr<T>>> for GcRef<'gc, T>
source§fn from(ptr: OwnedGcRef<'gc, T>) -> Self
fn from(ptr: OwnedGcRef<'gc, T>) -> Self
Freezes self
into a shared pointer
source§impl<'a, T: PartialEq> PartialEq for Borrow<'a, T>
impl<'a, T: PartialEq> PartialEq for Borrow<'a, T>
source§impl<'a, T: StackPrimitive + 'a> StackPrimitive for Borrow<'a, T>
impl<'a, T: StackPrimitive + 'a> StackPrimitive for Borrow<'a, T>
impl<'a, T: Eq> Eq for Borrow<'a, T>
impl<'a, T> StructuralEq for Borrow<'a, T>
impl<'a, T> StructuralPartialEq for Borrow<'a, T>
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for Borrow<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Borrow<'a, T>
impl<'a, T> Sync for Borrow<'a, T>where
T: Sync,
impl<'a, T> Unpin for Borrow<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Borrow<'a, T>where
T: UnwindSafe + RefUnwindSafe,
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<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&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> DowncastArc for T
impl<T> DowncastArc for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.