Struct stadium::RawHandle[][src]

pub struct RawHandle { /* fields omitted */ }

A handle to a T that does not own a T. This handle dos not remember what stadium created it.

Implementations

impl RawHandle[src]

pub unsafe fn trust<T>(self, stadium: &Stadium<'_>) -> Handle<T>[src]

Recreate an Handle from this RawHandle.

Safety

  • The generic type parameter T must be the same as the original Handle that was used to produce this RawHandle.
  • The given Stadium must be the one associated with the original handle.

Examples

let mut builder = stadium::builder();
let handle = builder.insert(5i32);
let stadium = builder.build();

let raw_handle = handle.raw();

// SAFETY: The handle was given by the builder that created the stadium and was
// created for a `i32`.
let handle = unsafe { raw_handle.trust::<i32>(&stadium) };

assert_eq!(stadium[handle], 5);

pub unsafe fn trust_with_builder<T>(self, builder: &Builder<'_>) -> Handle<T>[src]

Recreate an Handle from this RawHandle.

Safety

  • The generic type parameter T must be the same as the original Handle that was used to produce this RawHandle.
  • The given Builder must be the one associated with the original handle.

Examples

let mut builder = stadium::builder();
let raw_handle = builder.insert(5i32).raw();

// SAFETY: The handle was given by this builder and was created for a `i32`.
let handle = unsafe { raw_handle.trust_with_builder::<i32>(&builder) };

let stadium = builder.build();
assert_eq!(stadium[handle], 5);

Trait Implementations

impl Clone for RawHandle[src]

impl Copy for RawHandle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.