rune::core::object::tagged

Trait WithLifetime

Source
pub(crate) trait WithLifetime<'new> {
    type Out: 'new;

    // Required method
    unsafe fn with_lifetime(self) -> Self::Out;
}
Expand description

Helper trait to change the lifetime of a Gc mangaged type. This is useful because objects are initially tied to the lifetime of the Context they are allocated in. But when rooted the lifetime is dissociated from the Context. If we only worked with references, we could just use transmutes or casts to handle this, but generic types don’t expose their lifetimes. This trait is used to work around that. Must be used with extreme care, as it is easy to cast it to an invalid lifetime.

Required Associated Types§

Source

type Out: 'new

Required Methods§

Source

unsafe fn with_lifetime(self) -> Self::Out

Implementations on Foreign Types§

Source§

impl WithLifetime<'_> for i64

Source§

type Out = i64

Source§

unsafe fn with_lifetime(self) -> Self::Out

Source§

impl<'new, T> WithLifetime<'new> for Option<T>
where T: WithLifetime<'new>,

Source§

type Out = Option<<T as WithLifetime<'new>>::Out>

Source§

unsafe fn with_lifetime(self) -> Self::Out

Source§

impl<'new, T> WithLifetime<'new> for VecDeque<T>
where T: WithLifetime<'new>,

Source§

type Out = VecDeque<<T as WithLifetime<'new>>::Out>

Source§

unsafe fn with_lifetime(self) -> Self::Out

Source§

impl<'new, T> WithLifetime<'new> for Vec<T>
where T: WithLifetime<'new>,

Source§

type Out = Vec<<T as WithLifetime<'new>>::Out>

Source§

unsafe fn with_lifetime(self) -> Self::Out

Source§

impl<'new, T, U> WithLifetime<'new> for (T, U)
where T: WithLifetime<'new>, U: WithLifetime<'new>,

Source§

type Out = (<T as WithLifetime<'new>>::Out, <U as WithLifetime<'new>>::Out)

Source§

unsafe fn with_lifetime(self) -> Self::Out

Source§

impl<'new, T, const N: usize> WithLifetime<'new> for [T; N]
where T: WithLifetime<'new>,

Source§

type Out = [<T as WithLifetime<'new>>::Out; N]

Source§

unsafe fn with_lifetime(self) -> Self::Out

Implementors§

Source§

impl<'new> WithLifetime<'new> for &SubrFn

Source§

type Out = &'new SubrFn

Source§

impl<'new> WithLifetime<'new> for OpenBuffer<'_>

Source§

type Out = OpenBuffer<'new>

Source§

impl<'new> WithLifetime<'new> for Symbol<'_>

Source§

type Out = Symbol<'new>

Source§

impl<'new, T: WithLifetime<'new> + Copy> WithLifetime<'new> for Slot<T>

Source§

type Out = Slot<<T as WithLifetime<'new>>::Out>

Source§

impl<'new, T: WithLifetime<'new>> WithLifetime<'new> for Gc<T>

Source§

type Out = Gc<<T as WithLifetime<'new>>::Out>

Source§

impl<'old, 'new> WithLifetime<'new> for &'old Cons

Source§

type Out = &'new Cons

Source§

impl<'old, 'new> WithLifetime<'new> for &'old LispBuffer

Source§

type Out = &'new LispBuffer

Source§

impl<'old, 'new> WithLifetime<'new> for &'old LispFloat

Source§

type Out = &'new LispFloat

Source§

impl<'old, 'new> WithLifetime<'new> for &'old ByteFn

Source§

type Out = &'new ByteFn

Source§

impl<'old, 'new> WithLifetime<'new> for &'old LispHashTable

Source§

impl<'old, 'new> WithLifetime<'new> for &'old ByteString

Source§

type Out = &'new ByteString

Source§

impl<'old, 'new> WithLifetime<'new> for &'old LispString

Source§

type Out = &'new LispString

Source§

impl<'old, 'new> WithLifetime<'new> for &'old LispVec

Source§

type Out = &'new LispVec

Source§

impl<'old, 'new> WithLifetime<'new> for &'old Record

Source§

type Out = &'new Record

Source§

impl<'old, 'new> WithLifetime<'new> for FunctionType<'old>

Source§

impl<'old, 'new> WithLifetime<'new> for ListType<'old>

Source§

type Out = ListType<'new>

Source§

impl<'old, 'new> WithLifetime<'new> for NumberType<'old>

Source§

type Out = NumberType<'new>

Source§

impl<'old, 'new> WithLifetime<'new> for ObjectType<'old>

Source§

type Out = ObjectType<'new>

Source§

impl<'old, 'new> WithLifetime<'new> for Handler<'old>

Source§

type Out = Handler<'new>

Source§

impl<'old, 'new> WithLifetime<'new> for FrameStore<'old>

Source§

type Out = FrameStore<'new>