pub struct AssetPool {
active: Vec<AssetRef>,
future: Vec<Asset>,
decommissioned: Vec<AssetRef>,
next_id: u32,
next_group_id: u32,
}Expand description
A pool of Assets
Fields§
§active: Vec<AssetRef>The pool of active assets, sorted by ID
future: Vec<Asset>Assets that have not yet been commissioned, sorted by commission year
decommissioned: Vec<AssetRef>Assets that have been decommissioned
next_id: u32Next available asset ID number
next_group_id: u32Next available group ID number
Implementations§
Source§impl AssetPool
impl AssetPool
Sourcepub fn update_for_year(&mut self, year: u32)
pub fn update_for_year(&mut self, year: u32)
Decommission assets whose lifetime has passed, and commission new assets
Sourcefn commission_new(&mut self, year: u32)
fn commission_new(&mut self, year: u32)
Commission new assets for the specified milestone year from the input data
Sourcefn decommission_old(&mut self, year: u32)
fn decommission_old(&mut self, year: u32)
Decommission old assets for the specified milestone year
Sourcepub fn decommission_mothballed(&mut self, year: u32, mothball_years: u32)
pub fn decommission_mothballed(&mut self, year: u32, mothball_years: u32)
Decomission mothballed assets if mothballed long enough
Sourcepub fn mothball_unretained<I>(&mut self, assets: I, year: u32)where
I: IntoIterator<Item = AssetRef>,
pub fn mothball_unretained<I>(&mut self, assets: I, year: u32)where
I: IntoIterator<Item = AssetRef>,
Sourcepub fn iter_active(&self) -> Iter<'_, AssetRef>
pub fn iter_active(&self) -> Iter<'_, AssetRef>
Iterate over active assets
Sourcepub fn iter_decommissioned(&self) -> Iter<'_, AssetRef>
pub fn iter_decommissioned(&self) -> Iter<'_, AssetRef>
Iterate over decommissioned assets
Sourcepub fn iter_all(&self) -> impl Iterator<Item = &AssetRef>
pub fn iter_all(&self) -> impl Iterator<Item = &AssetRef>
Iterate over all commissioned and decommissioned assets.
NB: Not-yet-commissioned assets are not included.
Sourcepub fn extend<I>(&mut self, assets: I)where
I: IntoIterator<Item = AssetRef>,
pub fn extend<I>(&mut self, assets: I)where
I: IntoIterator<Item = AssetRef>,
Extend the active pool with Commissioned or Selected assets
Auto Trait Implementations§
impl Freeze for AssetPool
impl RefUnwindSafe for AssetPool
impl !Send for AssetPool
impl !Sync for AssetPool
impl Unpin for AssetPool
impl UnwindSafe for AssetPool
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
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>
Converts
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>
Converts
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