pub struct PandemicModel {
pop: BTreeMap<PersonID, State>,
bldgs: SharedSpace<BuildingID>,
bus_stops: SharedSpace<TransitStopID>,
buses: SharedSpace<CarID>,
person_to_bus: BTreeMap<PersonID, CarID>,
rng: XorShiftRng,
initialized: bool,
}
Fields
pop: BTreeMap<PersonID, State>
bldgs: SharedSpace<BuildingID>
bus_stops: SharedSpace<TransitStopID>
buses: SharedSpace<CarID>
person_to_bus: BTreeMap<PersonID, CarID>
rng: XorShiftRng
initialized: bool
Implementations
sourceimpl PandemicModel
impl PandemicModel
pub fn new(rng: XorShiftRng) -> PandemicModel
pub(crate) fn initialize(
&mut self,
population: &[Person],
_scheduler: &mut Scheduler
)
pub fn count_sane(&self) -> usize
pub fn count_exposed(&self) -> usize
pub fn count_infected(&self) -> usize
pub fn count_recovered(&self) -> usize
pub fn count_dead(&self) -> usize
pub fn count_total(&self) -> usize
pub(crate) fn handle_event(
&mut self,
now: Time,
ev: &Event,
scheduler: &mut Scheduler
)
pub(crate) fn handle_cmd(
&mut self,
_now: Time,
cmd: Cmd,
_scheduler: &mut Scheduler
)
pub fn get_time(&self, person: PersonID) -> Option<Time>
pub fn is_sane(&self, person: PersonID) -> bool
pub fn is_infectious(&self, person: PersonID) -> bool
pub fn is_exposed(&self, person: PersonID) -> bool
pub fn is_recovered(&self, person: PersonID) -> bool
pub fn is_dead(&self, person: PersonID) -> bool
fn infectious_contact(
&self,
person: PersonID,
other: PersonID
) -> Option<PersonID>
fn transmission(
&mut self,
now: Time,
person: PersonID,
other_occupants: Vec<(PersonID, Duration)>,
scheduler: &mut Scheduler
)
fn transition(
&mut self,
now: Time,
person: PersonID,
_scheduler: &mut Scheduler
)
fn become_exposed(
&mut self,
now: Time,
overlap: Duration,
person: PersonID,
_scheduler: &mut Scheduler
)
Trait Implementations
sourceimpl Clone for PandemicModel
impl Clone for PandemicModel
sourcefn clone(&self) -> PandemicModel
fn clone(&self) -> PandemicModel
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for PandemicModel
impl Send for PandemicModel
impl Sync for PandemicModel
impl Unpin for PandemicModel
impl UnwindSafe for PandemicModel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more