[][src]Struct dybs::My

pub struct My<T: ?Sized> { /* fields omitted */ }

A dynamic exclusively-owning smart pointer to a value

Implementations

impl<T> My<T>[src]

pub fn new(data: T) -> My<T>[src]

Construct a new exclusively-owning My pointer from a value

impl<T: ?Sized> My<T>[src]

pub fn borrow(&self) -> Dyb<T>[src]

Dynamically borrow the value

This borrow may live for any lifetime less than that of the bounds on the value itself - notably, this implies that (as far as the borrow-checker is concerned) it may outlive the owner itself!

This actually shifts the responsibility for ensuring the value lives long enough back onto the owner (just like the static borrow checker) with the caveat that dropping the value early will fail at runtime.

Dybs satisfies this requirement by leaking the value and panicking in this case. The leaking ensures soundness as in the worst case the value will just live forever, while panicking ensures the error is reported at the appropriate time rather than unfairly blaming a Dyb for holding a borrow for "too long" or entirely ignoring the problem.

Trait Implementations

impl<T: Clone> Clone for My<T>[src]

impl<T: ?Sized> Deref for My<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T: ?Sized> Drop for My<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for My<T> where
    T: RefUnwindSafe

impl<T> !Send for My<T>

impl<T> !Sync for My<T>

impl<T: ?Sized> Unpin for My<T>

impl<T: ?Sized> UnwindSafe for My<T> where
    T: RefUnwindSafe

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.