Struct seaplane_cli::ops::formation::Formations
source · pub struct Formations {
pub formations: Vec<Formation>,
pub configurations: Vec<FormationConfiguration>,
/* private fields */
}Expand description
This struct represents a Local Formation. I.e. one the user can interact with on the CLI and can be (de)serialized locally.
A somewhat counter-intuitive thing about “Formations” and their models is the there is no “Formation Model” only a “Formation Configuration Model” This is because a “Formation” so to speak is really just a named collection of configurations and info about their traffic weights/activation statuses.
Fields
formations: Vec<Formation>A list of “Formation“s
configurations: Vec<FormationConfiguration>A list of “Formation Configuration“s
We keep these separate from the Formation themselves because multiple formations can reference the same configuration.
Implementations
sourceimpl Formations
impl Formations
pub fn get_configuration_by_uuid(
&self,
uuid: Uuid
) -> Option<&FormationConfiguration>
pub fn remote_names(&self) -> Vec<&str>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
pub fn has_flight(&self, flight: &str) -> bool
pub fn formations(&self) -> impl Iterator<Item = &Formation>
pub fn configurations(&self) -> impl Iterator<Item = &FormationConfiguration>
pub fn get_configuration(&self, id: &Id) -> Option<&FormationConfiguration>
sourcepub fn remove_configuration(&mut self, id: &Id) -> Option<FormationConfiguration>
pub fn remove_configuration(&mut self, id: &Id) -> Option<FormationConfiguration>
Returns the removed FormationConfiguration by ID or None if there was no match
DANGER: this will invalidate any previously held indices after the removed item
pub fn get_formation(&self, idx: usize) -> Option<&Formation>
pub fn get_formation_mut(&mut self, idx: usize) -> Option<&mut Formation>
sourcepub fn update_or_create_configuration(
&mut self,
cfg: FormationConfiguration
) -> Option<Id>
pub fn update_or_create_configuration(
&mut self,
cfg: FormationConfiguration
) -> Option<Id>
Either updates a matching local Formation Configurations, or creates a new one. Returns the existing ID of the config that was updated if any
sourcepub fn update_or_create_formation(&mut self, formation: Formation) -> Option<Id>
pub fn update_or_create_formation(&mut self, formation: Formation) -> Option<Id>
Either updates a matching local Formations by replacing the local IDs, or creates a new one. Returns NEW Formations IDs
pub fn add_uuid(&mut self, id: &Id, uuid: Uuid)
pub fn add_in_air_by_name(&mut self, name: &str, id: Id)
pub fn add_grounded_by_name(&mut self, name: &str, id: Id)
sourcepub fn contains_name(&self, name: &str) -> bool
pub fn contains_name(&self, name: &str) -> bool
Returns true if there is a Formation with the given name
sourcepub fn remove_name(&mut self, name: &str) -> Option<Formation>
pub fn remove_name(&mut self, name: &str) -> Option<Formation>
Removes an exact name match, returning the removed Formation or None if nothing matched.
DANGER: this will invalidate any previously held indices after the removed item
sourcepub fn formation_index_of_name(&self, name: &str) -> Option<usize>
pub fn formation_index_of_name(&self, name: &str) -> Option<usize>
Returns the index of an exact name match
pub fn configuration_index_of_id(&self, id: &Id) -> Option<usize>
sourcepub fn formation_indices_of_matches(&self, name: &str) -> Vec<usize>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn formation_indices_of_matches(&self, name: &str) -> Vec<usize>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Returns all indices of an exact name or partial ID match
sourcepub fn formation_indices_of_left_matches(&self, name: &str) -> Vec<usize>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn formation_indices_of_left_matches(&self, name: &str) -> Vec<usize>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Returns all indices of a partial name or ID match
sourcepub fn remove_formation_indices(&mut self, indices: &[usize]) -> Vec<Formation>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn remove_formation_indices(&mut self, indices: &[usize]) -> Vec<Formation>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Removes all indices
sourcepub fn remove_flight(&mut self, flight: &str)
pub fn remove_flight(&mut self, flight: &str)
Removes the given flight from all formations that reference it
Trait Implementations
sourceimpl Clone for Formations
impl Clone for Formations
sourcefn clone(&self) -> Formations
fn clone(&self) -> Formations
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more