Struct RuFiPlatform

Source
pub struct RuFiPlatform<M, N, D, S>
where M: Mailbox, N: Network, D: Discovery, S: NbrSensorSetup,
{ /* private fields */ }
Expand description

This struct represents the platform on which the program is executed

Implementations§

Source§

impl<M, N, D, S> RuFiPlatform<M, N, D, S>
where M: Mailbox, N: Network, D: Discovery, S: NbrSensorSetup,

Source

pub fn new( mailbox: M, network: N, context: Context, discovery: D, setup: S, ) -> Self

Creates a new platform

Source

pub async fn run_forever<P, A>(self, program: P) -> Result<(), Box<dyn Error>>
where P: Fn(&mut RoundVM) -> A + Copy, A: Clone + 'static + FromStr + Display,

Runs indefinitely the program on the platform

§Arguments
  • program - The aggregate program to be executed
§Generic Arguments
  • P - The type of the aggregate program, it must be a function that takes a RoundVM and returns a RoundVM and a result of type A
  • A - The type of the result of the aggregate program
Source

pub async fn run_n_cycles<P, A>( self, program: P, n: usize, ) -> Result<(), Box<dyn Error>>
where P: Fn(&mut RoundVM) -> A + Copy, A: Clone + 'static + FromStr + Display,

Auto Trait Implementations§

§

impl<M, N, D, S> Freeze for RuFiPlatform<M, N, D, S>
where M: Freeze, N: Freeze, D: Freeze, S: Freeze,

§

impl<M, N, D, S> !RefUnwindSafe for RuFiPlatform<M, N, D, S>

§

impl<M, N, D, S> !Send for RuFiPlatform<M, N, D, S>

§

impl<M, N, D, S> !Sync for RuFiPlatform<M, N, D, S>

§

impl<M, N, D, S> Unpin for RuFiPlatform<M, N, D, S>
where M: Unpin, N: Unpin, D: Unpin, S: Unpin,

§

impl<M, N, D, S> !UnwindSafe for RuFiPlatform<M, N, D, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.