Struct oxygengine_overworld::components::inventory::Inventory
source · pub struct Inventory { /* private fields */ }Implementations§
source§impl Inventory
impl Inventory
pub fn new(capacity_weight: Option<Scalar>) -> Self
pub fn with_resize(capacity_weight: Option<Scalar>, items_resize: usize) -> Self
pub fn items(&self) -> impl Iterator<Item = (MarketItemId, usize)> + '_
pub fn contains(&self, id: MarketItemId) -> Option<usize>
pub fn can_add<T, V>( &self, id: MarketItemId, count: usize, database: &MarketDatabase<T, V> ) -> boolwhere T: Debug + Clone + Send + Sync, V: Currency + Debug + Clone + Send + Sync,
pub fn add<T, V>( &mut self, id: MarketItemId, count: usize, database: &MarketDatabase<T, V> ) -> Result<(), InventoryError>where T: Debug + Clone + Send + Sync, V: Currency + Debug + Clone + Send + Sync,
pub fn can_remove(&self, id: MarketItemId, count: usize) -> bool
pub fn remove( &mut self, id: MarketItemId, count: usize ) -> Result<(), InventoryError>
pub fn transfer<T, V>( &mut self, receiver: &mut Self, id: MarketItemId, count: usize, database: &MarketDatabase<T, V> ) -> Result<(), InventoryError>where T: Debug + Clone + Send + Sync, V: Currency + Debug + Clone + Send + Sync,
Trait Implementations§
source§impl<'de> Deserialize<'de> for Inventory
impl<'de> Deserialize<'de> for Inventory
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Prefab for Inventory
impl Prefab for Inventory
fn from_prefab(data: &Value) -> Result<Self, PrefabError>
fn from_prefab_with_extras( data: &Value, _named_entities: &HashMap<String, Entity, RandomState>, _state_token: ID<PhantomData<dyn State + Sync + Send>> ) -> Result<Self, PrefabError>
fn to_prefab(&self) -> Result<Value, PrefabError>
fn from_prefab_str(data: &str) -> Result<Self, PrefabError>
fn to_prefab_string(&self) -> Result<String, PrefabError>
fn post_from_prefab(&mut self)
impl PrefabComponent for Inventory
Auto Trait Implementations§
impl RefUnwindSafe for Inventory
impl Send for Inventory
impl Sync for Inventory
impl Unpin for Inventory
impl UnwindSafe for Inventory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Initialize for Twhere
T: Default,
impl<T> Initialize for Twhere T: Default,
fn initialize(&mut self)
§unsafe fn initialize_raw(data: *mut ())
unsafe fn initialize_raw(data: *mut ())
Safety Read more
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.