Bundle

Struct Bundle 

Source
pub struct Bundle<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> { /* private fields */ }
Expand description

Contains a fixed (compile-time known) amount of a resource. A Bundle can be used to build structures or as input for recipes.

Implementations§

Source§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> Bundle<RESOURCE_TYPE, AMOUNT>

Source

pub fn resource_type(&self) -> ResourceType

Source

pub fn amount(&self) -> u32

Source

pub fn to_resource(self) -> Resource<RESOURCE_TYPE>

Converts this Bundle into a Resource with the same resource type and amount.

Trait Implementations§

Source§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> Add<Bundle<RESOURCE_TYPE, AMOUNT>> for Resource<RESOURCE_TYPE>

Source§

type Output = Resource<RESOURCE_TYPE>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Bundle<RESOURCE_TYPE, AMOUNT>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT_LHS: u32, const AMOUNT_RHS: u32> Add<Bundle<RESOURCE_TYPE, AMOUNT_RHS>> for Bundle<RESOURCE_TYPE, AMOUNT_LHS>

Source§

type Output = Resource<RESOURCE_TYPE>

The resulting type after applying the + operator.
Source§

fn add(self, _rhs: Bundle<RESOURCE_TYPE, AMOUNT_RHS>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> Add<Resource<RESOURCE_TYPE>> for Bundle<RESOURCE_TYPE, AMOUNT>

Source§

type Output = Resource<RESOURCE_TYPE>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Resource<RESOURCE_TYPE>) -> Self::Output

Performs the + operation. Read more
Source§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> AddAssign<Bundle<RESOURCE_TYPE, AMOUNT>> for Resource<RESOURCE_TYPE>

Source§

fn add_assign(&mut self, _bundle: Bundle<RESOURCE_TYPE, AMOUNT>)

Performs the += operation. Read more

Auto Trait Implementations§

§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> Freeze for Bundle<RESOURCE_TYPE, AMOUNT>

§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> RefUnwindSafe for Bundle<RESOURCE_TYPE, AMOUNT>

§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> Send for Bundle<RESOURCE_TYPE, AMOUNT>

§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> Sync for Bundle<RESOURCE_TYPE, AMOUNT>

§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> Unpin for Bundle<RESOURCE_TYPE, AMOUNT>

§

impl<const RESOURCE_TYPE: ResourceType, const AMOUNT: u32> UnwindSafe for Bundle<RESOURCE_TYPE, AMOUNT>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.