pub struct AssetRef(Rc<Asset>);Expand description
Tuple Fields§
§0: Rc<Asset>Implementations§
Source§impl AssetRef
impl AssetRef
Sourcefn get_asset_cmp(&self) -> AssetCmp<'_>
fn get_asset_cmp(&self) -> AssetCmp<'_>
Get a representation of this AssetRef that can be used for comparisons
Sourcepub fn with_subset_of_units(self, new_num_units: u32) -> Self
pub fn with_subset_of_units(self, new_num_units: u32) -> Self
Get an AssetRef representing a subset of this asset’s units.
For non-divisible assets, new_num_units must be one. If some of the asset’s units are
mothballed, these are discarded before non-mothballed units. For example, if an asset has
seven units of which four are mothballed and we are reducing the number of units to four,
the new asset will have one mothballed unit.
§Panics
Panics if new_num_units is zero or exceeds the total capacity of this asset.
Sourcefn decommission(self, reason: &str)
fn decommission(self, reason: &str)
Decommission this asset
Sourcefn with_decommission_mothballed(
self,
year: u32,
mothball_years: u32,
) -> Option<Self>
fn with_decommission_mothballed( self, year: u32, mothball_years: u32, ) -> Option<Self>
Decommission any units that were mothballed at least mothball_years ago.
If the asset still has some units remaining, it is returned, else None.
Sourcepub fn with_mothballed_units(self, num_units: u32, year: Option<u32>) -> Self
pub fn with_mothballed_units(self, num_units: u32, year: Option<u32>) -> Self
Return a new AssetRef with the specified number of units mothballed.
If num_units equals the number of already mothballed units, the original asset is
returned. If additional units may be mothballed, a value must be provided for year.
§Panics
Panics if attempting to mothball more units than the asset represents or if attempting to change the number of mothballed units for a non-commissioned asset.
Sourcepub fn with_no_mothballed_units(self) -> Self
pub fn with_no_mothballed_units(self) -> Self
Returns a new AssetRef with no mothballed units.
If the asset has no mothballed units, the original asset is returned.
Trait Implementations§
Source§impl Ord for AssetRef
impl Ord for AssetRef
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for AssetRef
impl PartialOrd for AssetRef
impl Eq for AssetRef
Auto Trait Implementations§
impl Freeze for AssetRef
impl RefUnwindSafe for AssetRef
impl !Send for AssetRef
impl !Sync for AssetRef
impl Unpin for AssetRef
impl UnsafeUnpin for AssetRef
impl UnwindSafe for AssetRef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more