[][src]Struct xaynet_mobile::Participant

pub struct Participant { /* fields omitted */ }

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:

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,