[−][src]Struct xaynet_mobile::Participant
A participant. It embeds an internal state machine that executes the PET
protocol. However, it is the caller's responsibility to drive this state machine by
calling Participant::tick()
, and to take action when the participant state
changes.
Implementations
impl Participant
[src]
pub fn new(settings: Settings) -> Result<Self, InitError>
[src]
Create a new participant with the given settings
pub fn restore(state: &[u8], url: &str) -> Result<Self, InitError>
[src]
Restore a participant from it's serialized state. The coordinator client that
the participant uses internally is not part of the participant state, so the
url
is used to instantiate a new one.
pub fn save(self) -> Vec<u8>
[src]
Serialize the participant state and return the corresponding buffer.
pub fn tick(&mut self)
[src]
Drive the participant internal state machine.
After calling this method, the caller should check whether the participant state
changed, by calling Participant::made_progress()
. If the state changed, the
caller should perform the following checks and react appropriately:
- whether the participant is taking part to any task by calling
Participant::task()
- whether the participant should load its model into the store by calling
Participant::should_set_model()
pub fn made_progress(&self) -> bool
[src]
Check whether the participant internal state machine made progress while executing the PET protocol. If so, the participant state likely changed.
pub fn should_set_model(&self) -> bool
[src]
Check whether the participant internal state machine is waiting for the
participant to load its model into the store. If this method returns true
, the
caller should make sure to call Participant::set_model()
at some point.
pub fn new_global_model(&self) -> bool
[src]
Check whether a new global model is available. If this method returns true
, the
caller can call Participant::global_model()
to fetch the new global model.
pub fn task(&self) -> Task
[src]
Return the participant current task
pub fn set_model(&mut self, model: Model)
[src]
Load the given model into the store, so that the participant internal state machine can process it.
pub fn global_model(&mut self) -> Result<Option<Model>, GetGlobalModelError>
[src]
Retrieve the current global model, if available.
pub fn local_model_config(&self) -> LocalModelConfig
[src]
Return the local model configuration of the model that is expected in the
Participant::set_model
method.
Auto Trait Implementations
impl !RefUnwindSafe for Participant
[src]
impl Send for Participant
[src]
impl !Sync for Participant
[src]
impl Unpin for Participant
[src]
impl !UnwindSafe for Participant
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,