pub struct State { /* private fields */ }Expand description
State containing at least location info
Implementations§
Source§impl State
impl State
Sourcepub fn new(cache: &Cache) -> Result<Self>
pub fn new(cache: &Cache) -> Result<Self>
Build a state, either by reading current persisted state in cache
or by creating an empty default one.
Sourcepub fn set_location(&mut self, location: Location, cache: &Cache) -> Result<()>
pub fn set_location(&mut self, location: Location, cache: &Cache) -> Result<()>
Update state with location and ensure persisting of state on disk
Sourcepub fn update_status(
&mut self,
current_location: Location,
status: Option<&mut MMStatus>,
session: &mut Box<dyn BaseSession>,
cache: &Cache,
delay_between_polling: u64,
) -> Result<()>
pub fn update_status( &mut self, current_location: Location, status: Option<&mut MMStatus>, session: &mut Box<dyn BaseSession>, cache: &Cache, delay_between_polling: u64, ) -> Result<()>
Update mattermost status depending upon current state
If current_location is Unknown, then nothing is changed.
If current_location is still the same for more than MAX_SECS_BEFORE_FORCE_UPDATE
then we force update the mattermost status in order to catch up with desynchronise state
Else we update mattermost status to the one associated to current_location.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for State
impl<'de> Deserialize<'de> for State
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
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnwindSafe for State
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