pub struct CampaignIndex { /* private fields */ }Expand description
The start_pos_* rows of one campaign, with their references resolved to keys.
Implementations§
Source§impl CampaignIndex
impl CampaignIndex
Sourcepub fn factions(&self) -> &Vec<FactionEntry>
pub fn factions(&self) -> &Vec<FactionEntry>
Factions of the campaign, in start_pos_factions order.
Sourcepub fn regions(&self) -> &Vec<RegionEntry>
pub fn regions(&self) -> &Vec<RegionEntry>
Regions of the campaign, in start_pos_regions order.
Sourcepub fn settlements(&self) -> &Vec<SettlementEntry>
pub fn settlements(&self) -> &Vec<SettlementEntry>
Settlements of the campaign’s regions, in start_pos_settlements order.
Sourcepub fn characters(&self) -> &Vec<CharacterEntry>
pub fn characters(&self) -> &Vec<CharacterEntry>
Characters of the campaign’s factions, in start_pos_characters order.
Source§impl CampaignIndex
impl CampaignIndex
Sourcepub fn new(tables: &StartposTables, campaign: &str) -> Result<Self>
pub fn new(tables: &StartposTables, campaign: &str) -> Result<Self>
Indexes the startpos rows of a campaign.
§Arguments
tables- Tables withstart_pos_factions,start_pos_regions,start_pos_settlements,start_pos_characters,factionsandcultures_subcultures.campaign- Campaign key.
§Errors
Returns an error if a table or column is missing, or a faction lacks its factions row.
Sourcepub fn faction(&self, key: &str) -> Option<&FactionEntry>
pub fn faction(&self, key: &str) -> Option<&FactionEntry>
Returns a faction by key.
Sourcepub fn faction_by_id(&self, id: &str) -> Option<&FactionEntry>
pub fn faction_by_id(&self, id: &str) -> Option<&FactionEntry>
Returns a faction by its start_pos_factions row id.
Sourcepub fn region(&self, key: &str) -> Option<&RegionEntry>
pub fn region(&self, key: &str) -> Option<&RegionEntry>
Returns a region by key.
Sourcepub fn regions_of<'a>(
&'a self,
faction: &'a str,
) -> impl Iterator<Item = &'a RegionEntry> + 'a
pub fn regions_of<'a>( &'a self, faction: &'a str, ) -> impl Iterator<Item = &'a RegionEntry> + 'a
Returns the regions owned by a faction, in table order.
Sourcepub fn capital_of<'a>(&'a self, faction: &'a str) -> Option<&'a RegionEntry>
pub fn capital_of<'a>(&'a self, faction: &'a str) -> Option<&'a RegionEntry>
Returns the capital of a faction: the first of its regions flagged as capital, in table order.
Sourcepub fn settlement_of(&self, region: &str) -> Option<&SettlementEntry>
pub fn settlement_of(&self, region: &str) -> Option<&SettlementEntry>
Returns the settlement of a region.
Sourcepub fn characters_of<'a>(
&'a self,
faction: &'a str,
) -> impl Iterator<Item = &'a CharacterEntry> + 'a
pub fn characters_of<'a>( &'a self, faction: &'a str, ) -> impl Iterator<Item = &'a CharacterEntry> + 'a
Returns the characters of a faction, in table order.
Sourcepub fn factions_in_startpos_order(&self) -> Vec<&FactionEntry>
pub fn factions_in_startpos_order(&self) -> Vec<&FactionEntry>
Returns the factions in startpos order: playable factions first, each group by starting_order.
The game sorts with an unstable sort, so factions with the same starting order may come out in another order in game-built startposes.
Trait Implementations§
Source§impl Clone for CampaignIndex
impl Clone for CampaignIndex
Source§fn clone(&self) -> CampaignIndex
fn clone(&self) -> CampaignIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CampaignIndex
impl Debug for CampaignIndex
Source§impl Default for CampaignIndex
impl Default for CampaignIndex
Source§fn default() -> CampaignIndex
fn default() -> CampaignIndex
Auto Trait Implementations§
impl Freeze for CampaignIndex
impl RefUnwindSafe for CampaignIndex
impl Send for CampaignIndex
impl Sync for CampaignIndex
impl Unpin for CampaignIndex
impl UnsafeUnpin for CampaignIndex
impl UnwindSafe for CampaignIndex
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreimpl<T> MaybeSend for T
impl<T> MaybeSync for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.