pub unsafe trait ResourceRep<T> {
// Required methods
fn rep_new(inner: T) -> Self;
unsafe fn rep_as_ref<'a>(ptr: *const Self) -> &'a T;
unsafe fn rep_as_mut<'a>(ptr: *mut Self) -> &'a mut T;
unsafe fn rep_take<'a>(ptr: *mut Self) -> T;
}Expand description
A trait used to define how to access the underlying data T from an
in-memory representation.
This is used as a bound on the Resource::Rep associated type which is in
turn used to access data within a resources.
Required Methods§
Sourceunsafe fn rep_as_ref<'a>(ptr: *const Self) -> &'a T
unsafe fn rep_as_ref<'a>(ptr: *const Self) -> &'a T
Acquires &T from a raw pointer to Self.
Sourceunsafe fn rep_as_mut<'a>(ptr: *mut Self) -> &'a mut T
unsafe fn rep_as_mut<'a>(ptr: *mut Self) -> &'a mut T
Acquires &mut T from a raw pointer to Self.
Sourceunsafe fn rep_take<'a>(ptr: *mut Self) -> T
unsafe fn rep_take<'a>(ptr: *mut Self) -> T
Takes the value out of Self at the provided pointer.
Note that ptr will later be deallocated meaning that it must not run
the destructor of T after this method is called. This is guaranteed to
be called at most once, however. Additionally after calling this method
it’s guaranteed that the rep_as_* method above will not be called.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".