[][src]Struct potential::Lease

pub struct Lease<T> { /* fields omitted */ }

The leased item. Item will be sent back to the owner on drop() unless stolen with steal().

Lease does not allow empty state so as long as it exists, it must have the item.

As long as Lease exists, Potential will be waiting for return (unless reset). Drop Lease or steal it to release the wait.

Implementations

impl<T> Lease<T>[src]

pub fn close(self) -> Option<T>[src]

Return the lease to owner, destroying the lease. If the owner doesn't listen anymore, the item is returned to caller.

pub fn replace(&mut self, replacement: T) -> T[src]

Replace the item within the lease

pub fn steal(self) -> T[src]

Steal the leased item destroying the lease. Potential await calls will return None.

Trait Implementations

impl<T: Debug> Debug for Lease<T>[src]

impl<T> Deref for Lease<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T> DerefMut for Lease<T>[src]

impl<T> Drop for Lease<T>[src]

fn drop(&mut self)[src]

drop() must be called for the item to return to the owner. Otherwise, the owner will be stuck waiting forever.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Lease<T>

impl<T> Send for Lease<T> where
    T: Send

impl<T> Sync for Lease<T> where
    T: Send + Sync

impl<T> Unpin for Lease<T> where
    T: Unpin

impl<T> !UnwindSafe for Lease<T>

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, 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.