Struct drone_core::inventory::Inventory[][src]

#[repr(transparent)]pub struct Inventory<T: Item, C: Unsigned> { /* fields omitted */ }

The inventory wrapper for T. Parameter C encodes the number of emitted tokens.

See the module-level documentation for details.

Implementations

impl<T: Item> Inventory<T, U0>[src]

pub fn new(item: T) -> Self[src]

Creates a new Inventory in the inactive state with zero tokens emitted.

item should contain some form of token.

pub fn free(inventory: Self) -> T[src]

Drops inventory and returns the stored item.

pub fn guard(inventory: &mut Self) -> Guard<'_, T>[src]

Creates an RAII scoped guard.

The item should be already in its active state. The returned guard will call Item::teardown on drop.

pub fn teardown(inventory: &mut Self)[src]

Calls Item::teardown for the stored item.

impl<T: Item, C: Unsigned> Inventory<T, C>[src]

pub fn inventory_token(&self) -> &Token<T>[src]

Returns a reference to Token<T>. While the reference exists, the item is always in its active state.

impl<T: Item, C: Unsigned> Inventory<T, C>[src]

pub fn share1(self) -> (Inventory<T, Sum<C, U1>>, Token<T>) where
    C: Add<U1>,
    Sum<C, U1>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn share2(self) -> (Inventory<T, Sum<C, U2>>, Token<T>, Token<T>) where
    C: Add<U2>,
    Sum<C, U2>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn share3(self) -> (Inventory<T, Sum<C, U3>>, Token<T>, Token<T>, Token<T>) where
    C: Add<U3>,
    Sum<C, U3>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn share4(
    self
) -> (Inventory<T, Sum<C, U4>>, Token<T>, Token<T>, Token<T>, Token<T>) where
    C: Add<U4>,
    Sum<C, U4>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn share5(
    self
) -> (Inventory<T, Sum<C, U5>>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>) where
    C: Add<U5>,
    Sum<C, U5>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn share6(
    self
) -> (Inventory<T, Sum<C, U6>>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>) where
    C: Add<U6>,
    Sum<C, U6>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn share7(
    self
) -> (Inventory<T, Sum<C, U7>>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>) where
    C: Add<U7>,
    Sum<C, U7>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn share8(
    self
) -> (Inventory<T, Sum<C, U8>>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>, Token<T>) where
    C: Add<U8>,
    Sum<C, U8>: Unsigned
[src]

Returns a token and a new inventory object with increased counter in its type.

pub fn merge1(self, a: Token<T>) -> Inventory<T, Diff<C, U1>> where
    C: Sub<U1>,
    Diff<C, U1>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

pub fn merge2(self, a: Token<T>, b: Token<T>) -> Inventory<T, Diff<C, U2>> where
    C: Sub<U2>,
    Diff<C, U2>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

pub fn merge3(
    self,
    a: Token<T>,
    b: Token<T>,
    c: Token<T>
) -> Inventory<T, Diff<C, U3>> where
    C: Sub<U3>,
    Diff<C, U3>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

pub fn merge4(
    self,
    a: Token<T>,
    b: Token<T>,
    c: Token<T>,
    d: Token<T>
) -> Inventory<T, Diff<C, U4>> where
    C: Sub<U4>,
    Diff<C, U4>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

pub fn merge5(
    self,
    a: Token<T>,
    b: Token<T>,
    c: Token<T>,
    d: Token<T>,
    e: Token<T>
) -> Inventory<T, Diff<C, U5>> where
    C: Sub<U5>,
    Diff<C, U5>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

pub fn merge6(
    self,
    a: Token<T>,
    b: Token<T>,
    c: Token<T>,
    d: Token<T>,
    e: Token<T>,
    f: Token<T>
) -> Inventory<T, Diff<C, U6>> where
    C: Sub<U6>,
    Diff<C, U6>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

pub fn merge7(
    self,
    a: Token<T>,
    b: Token<T>,
    c: Token<T>,
    d: Token<T>,
    e: Token<T>,
    f: Token<T>,
    g: Token<T>
) -> Inventory<T, Diff<C, U7>> where
    C: Sub<U7>,
    Diff<C, U7>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

pub fn merge8(
    self,
    a: Token<T>,
    b: Token<T>,
    c: Token<T>,
    d: Token<T>,
    e: Token<T>,
    f: Token<T>,
    g: Token<T>,
    h: Token<T>
) -> Inventory<T, Diff<C, U8>> where
    C: Sub<U8>,
    Diff<C, U8>: Unsigned
[src]

Consumes a token and returns a new inventory object with decreased counter in its type.

Trait Implementations

impl<T: Item, C: Unsigned> Deref for Inventory<T, C>[src]

type Target = T

The resulting type after dereferencing.

impl<T: Item, C: Unsigned> DerefMut for Inventory<T, C>[src]

Auto Trait Implementations

impl<T, C> Send for Inventory<T, C> where
    C: Send,
    T: Send

impl<T, C> Sync for Inventory<T, C> where
    C: Sync,
    T: Sync

impl<T, C> Unpin for Inventory<T, C> where
    C: Unpin,
    T: Unpin

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> Same<T> for T[src]

type Output = T

Should always be Self

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.