pub struct AssetPool {
active: Vec<AssetRef>,
future: Vec<Asset>,
decommissioned: Vec<AssetRef>,
next_id: u32,
}
Expand description
A pool of Asset
s
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: u32
Next available asset ID number
Implementations§
Source§impl AssetPool
impl AssetPool
Sourcepub fn commission_new(&mut self, year: u32)
pub fn commission_new(&mut self, year: u32)
Commission new assets for the specified milestone year from the input data
Sourcepub fn decommission_old(&mut self, year: u32)
pub fn decommission_old(&mut self, year: u32)
Decommission old assets for the specified milestone year
Sourcepub fn decommission_if_not_active<I>(&mut self, assets: I, year: u32)where
I: IntoIterator<Item = AssetRef>,
pub fn decommission_if_not_active<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
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