pub struct FootballTeam { /* private fields */ }Expand description
§FootballTeam struct
A FootballTeam represents a football team
Implementations§
Source§impl FootballTeam
impl FootballTeam
Sourcepub fn new() -> FootballTeam
pub fn new() -> FootballTeam
Constructor for the FootballTeam struct in which each
overall is defaulted to 50_i32, and the name is defaulted
§Example
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::new();Sourcepub fn from_overalls(
name: &str,
short_name: &str,
offense_overall: u32,
defense_overall: u32,
) -> Result<FootballTeam, String>
pub fn from_overalls( name: &str, short_name: &str, offense_overall: u32, defense_overall: u32, ) -> Result<FootballTeam, String>
Constructor for the FootballTeam struct in which an offense and defense
are constructed given their overalls
§Example
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::from_overalls("My Team", "TEAM", 25, 75);Sourcepub fn from_properties(
name: &str,
short_name: &str,
coach: FootballTeamCoach,
offense: FootballTeamOffense,
defense: FootballTeamDefense,
) -> FootballTeam
pub fn from_properties( name: &str, short_name: &str, coach: FootballTeamCoach, offense: FootballTeamOffense, defense: FootballTeamDefense, ) -> FootballTeam
Constructor for the FootballTeam struct in which each
property is given as an argument.
§Example
use fbsim_core::team::FootballTeam;
use fbsim_core::team::coach::FootballTeamCoach;
use fbsim_core::team::offense::FootballTeamOffense;
use fbsim_core::team::defense::FootballTeamDefense;
let my_coach = FootballTeamCoach::new();
let my_defense = FootballTeamDefense::new();
let my_offense = FootballTeamOffense::new();
let my_team = FootballTeam::from_properties("My Team", "TEAM", my_coach, my_offense, my_defense);Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Get the football team’s name
§Example
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::new();
let name = my_team.name();Sourcepub fn name_mut(&mut self) -> &mut String
pub fn name_mut(&mut self) -> &mut String
Get the football team’s name mutably
§Example
use fbsim_core::team::FootballTeam;
let mut my_team = FootballTeam::new();
let mut name = my_team.name_mut();Sourcepub fn short_name(&self) -> &str
pub fn short_name(&self) -> &str
Borrow the football team’s short name / acronym
§Example
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::new();
let short_name = my_team.short_name();Sourcepub fn short_name_mut(&mut self) -> &mut String
pub fn short_name_mut(&mut self) -> &mut String
Borrow the football team’s short name / acronym mutably
§Example
use fbsim_core::team::FootballTeam;
let mut my_team = FootballTeam::new();
let mut short_name = my_team.short_name_mut();Trait Implementations§
Source§impl Clone for FootballTeam
impl Clone for FootballTeam
Source§fn clone(&self) -> FootballTeam
fn clone(&self) -> FootballTeam
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FootballTeam
impl Debug for FootballTeam
Source§impl Default for FootballTeam
impl Default for FootballTeam
Source§fn default() -> FootballTeam
fn default() -> FootballTeam
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for FootballTeam
impl<'de> Deserialize<'de> for FootballTeam
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for FootballTeam
impl Ord for FootballTeam
Source§fn cmp(&self, other: &FootballTeam) -> Ordering
fn cmp(&self, other: &FootballTeam) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for FootballTeam
impl PartialEq for FootballTeam
Source§impl PartialOrd for FootballTeam
impl PartialOrd for FootballTeam
Source§impl PlaySimulatable for FootballTeam
impl PlaySimulatable for FootballTeam
Source§fn coach(&self) -> &FootballTeamCoach
fn coach(&self) -> &FootballTeamCoach
Borrow the team’s coach
§Example
use fbsim_core::game::play::PlaySimulatable;
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::new();
let my_coach = my_team.coach();Source§fn offense(&self) -> &FootballTeamOffense
fn offense(&self) -> &FootballTeamOffense
Borrow the team’s offense
§Example
use fbsim_core::game::play::PlaySimulatable;
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::new();
let my_offense = my_team.offense();Source§fn defense(&self) -> &FootballTeamDefense
fn defense(&self) -> &FootballTeamDefense
Borrow the team’s defense
§Example
use fbsim_core::game::play::PlaySimulatable;
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::new();
let my_defense = my_team.defense();Source§impl ScoreSimulatable for FootballTeam
impl ScoreSimulatable for FootballTeam
Source§fn name(&self) -> &str
fn name(&self) -> &str
Get the football team’s name
§Example
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::new();
let name = my_team.name();Source§fn defense_overall(&self) -> u32
fn defense_overall(&self) -> u32
Get the overall of the defense
§Example
use fbsim_core::game::score::ScoreSimulatable;
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::from_overalls("My Team", "TEAM", 25, 75).unwrap();
let defense_overall = my_team.defense_overall();
assert!(defense_overall == 75);Source§fn offense_overall(&self) -> u32
fn offense_overall(&self) -> u32
Get the overall of the offense
§Example
use fbsim_core::game::score::ScoreSimulatable;
use fbsim_core::team::FootballTeam;
let my_team = FootballTeam::from_overalls("My Team", "TEAM", 25, 75).unwrap();
let offense_overall = my_team.offense_overall();
assert!(offense_overall == 25);Source§impl Serialize for FootballTeam
impl Serialize for FootballTeam
Source§impl TryFrom<FootballTeamRaw> for FootballTeam
impl TryFrom<FootballTeamRaw> for FootballTeam
impl Eq for FootballTeam
impl StructuralPartialEq for FootballTeam
Auto Trait Implementations§
impl Freeze for FootballTeam
impl RefUnwindSafe for FootballTeam
impl Send for FootballTeam
impl Sync for FootballTeam
impl Unpin for FootballTeam
impl UnwindSafe for FootballTeam
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.