pub struct AssetRef(Arc<Asset>);Expand description
Tuple Fields§
§0: Arc<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_tranches(self, new_num_tranches: u32) -> Self
pub fn with_subset_of_tranches(self, new_num_tranches: u32) -> Self
Get an AssetRef representing a subset of this asset’s tranches.
If some of the asset’s tranches are mothballed, these are discarded before non-mothballed tranches. For example, if an asset has seven tranches of which four are mothballed and we are reducing the number of tranches to four, the new asset will have one mothballed tranche.
§Panics
Panics if new_num_tranches is zero or exceeds the total capacity of this asset.
Sourcepub fn as_single_tranche(self) -> Self
pub fn as_single_tranche(self) -> Self
Get an AssetRef representing a single tranche 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 tranches that were mothballed at least mothball_years ago.
If the asset still has some tranches remaining, it is returned, else None.
Sourcepub fn with_mothballed_tranches(
self,
num_tranches: u32,
year: Option<u32>,
) -> Self
pub fn with_mothballed_tranches( self, num_tranches: u32, year: Option<u32>, ) -> Self
Return a new AssetRef with the specified number of tranches mothballed.
If num_tranches equals the number of already mothballed tranches, the original asset is
returned. If additional tranches may be mothballed, a value must be provided for year.
§Panics
Panics if attempting to mothball more tranches than the asset represents or if attempting to change the number of mothballed tranches for a non-commissioned asset.
Sourcepub fn with_no_mothballed_tranches(self) -> Self
pub fn with_no_mothballed_tranches(self) -> Self
Returns a new AssetRef with no mothballed tranches.
If the asset has no mothballed tranches, the original asset is returned.
Trait Implementations§
impl Eq for AssetRef
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,
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