[][src]Trait gsrs::DerefWithLifetime

pub unsafe trait DerefWithLifetime<'a> {
    type Target: 'a;
    unsafe fn deref_with_lifetime(&'a self) -> &'a Self::Target;
unsafe fn deref_with_lifetime_mut(&'a mut self) -> &'a mut Self::Target;
unsafe fn move_with_lifetime(self) -> Self::Target;
unsafe fn move_with_lifetime_back(this: Self::Target) -> Self; }

This trait should be implemented for any struct that will contain references to data inside SRS and it should be implemented for any lifetime. Basically it just allows to apply custom lifetime to struct

It is already implemented for pure references. In general `deref_with_lifetime' macro should be used to implement this trait safely.

It is unsafe because SRS expects implementations of this trait to only change lifetime.

TODO this will only be implemented with macro in future

Associated Types

type Target: 'a

Implementors should make Target a Self but generic over 'a, see macro definition

Loading content...

Required methods

unsafe fn deref_with_lifetime(&'a self) -> &'a Self::Target

implementation should be just transmute(self) to only change lifetime

unsafe fn deref_with_lifetime_mut(&'a mut self) -> &'a mut Self::Target

implementation should be just transmute(self) to only change lifetime

unsafe fn move_with_lifetime(self) -> Self::Target

implementation should be just transmute(self) to only change lifetime

unsafe fn move_with_lifetime_back(this: Self::Target) -> Self

implementation should be just transmute(self) to only change lifetime

Loading content...

Implementations on Foreign Types

impl<'a, '_, Z: ?Sized + 'static> DerefWithLifetime<'a> for &'_ Z[src]

type Target = &'a Z

Loading content...

Implementors

Loading content...