Struct Ctx

Source
pub struct Ctx<G: Send + Sync> { /* private fields */ }
Expand description

Provide a interface to send and recieve Package’s to/from others Component’s and access to read and modify the global data of the Flow.

Implementations§

Source§

impl<G> Ctx<G>
where G: Send + Sync + 'static,

Source

pub fn receive(&mut self, in_port: PortId) -> Option<Package>

Recieve a Package from a Port

§Panics

Panic if recieve from a Input Port that not exist in this Component

Source

pub fn send(&mut self, out_port: PortId, package: Package)

Send a Package to a Port, if one Component is connected to this port than he can recieve that Package sent.

If more than one components is connected in this port, each one recieve a copy of this Package.

§Panics

Panic if send to a Output Port that not exist in this Component

Source

pub fn with_global<R>(&self, call: impl FnOnce(&G) -> R) -> Result<R, FlowError>

Interface tha provide a way to read the global data of the Flow

Source

pub fn with_mut_global<R>( &self, call: impl FnOnce(&mut G) -> R, ) -> Result<R, FlowError>

Interface tha provide a way to read and modify the global data of the Flow

Auto Trait Implementations§

§

impl<G> Freeze for Ctx<G>

§

impl<G> RefUnwindSafe for Ctx<G>

§

impl<G> Send for Ctx<G>

§

impl<G> Sync for Ctx<G>

§

impl<G> Unpin for Ctx<G>

§

impl<G> UnwindSafe for Ctx<G>

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.