Struct feroxide::Container
[−]
[src]
pub struct Container<E: Element> { pub contents: Vec<ContainerCompound<E>>, pub available_energy: Energy, }
A container for elements
Fields
contents: Vec<ContainerCompound<E>>
A vector with the contents of this container
available_energy: Energy
The amount of energy available
Methods
impl<E: Element> Container<E>
[src]
fn react<R: Reaction<E>>(&mut self, reaction: &R) -> bool
[src]
Applies given Reaction
to Container
Removing the elements on the left-hand side
and adding the elements on the right-hand side.
If there is enough energy for the reaction, that amount will be consumed
otherwise the reaction won't occur.
Returns if the reaction succeeded
fn has_elements(&mut self, elements: &[ContainerCompound<E>]) -> bool
[src]
Check if the container has all given elements
fn remove_elements(&mut self, elements: &[ContainerCompound<E>])
[src]
Remove given elements from container
fn add_elements(&mut self, elements: &[ContainerCompound<E>])
[src]
Add given elements to container
fn stringify(&self) -> String
[src]
Convert container to a nice string for displaying
Trait Implementations
impl<E: Debug + Element> Debug for Container<E>
[src]
impl<E: Clone + Element> Clone for Container<E>
[src]
fn clone(&self) -> Container<E>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more