Skip to main content

Wait

Struct Wait 

Source
pub struct Wait { /* private fields */ }

Implementations§

Source§

impl Wait

Source

pub fn new(event: WaitEvent) -> Self

Examples found in repository?
examples/bind_and_connect.rs (lines 71-74)
48fn create_node_1() -> Node {
49    let mut node = Node::new("test-node-1");
50    let bind_action = Bind::new("192.168.1.10:3000".parse().unwrap());
51    let sleep_action = Sleep::new(1000);
52    let connection_action = Connect::new(
53        "192.168.1.10:0".parse().unwrap(),
54        "192.168.1.11:4000".parse().unwrap(),
55        1000,
56    );
57    let send_unicast_action = Send::new(
58        SendMode::Unicast,
59        "192.168.1.10:3000".parse().unwrap(),
60        "192.168.1.11:4000".parse().unwrap(),
61        vec![1, 2, 3, 4],
62    );
63
64    let send_broadcast_action = Send::new(
65        SendMode::Broadcast,
66        "192.168.1.10:0".parse().unwrap(),
67        "192.168.1.255:49999".parse().unwrap(),
68        vec![1, 2, 3, 4],
69    );
70
71    let wait_connection_action = Wait::new(WaitEvent::Connection(ConnectPredicate::new(
72        "192.168.1.11:0".parse().unwrap(),
73        "192.168.1.10:3000".parse().unwrap(),
74    )));
75
76    let wait_message_action = Wait::new(WaitEvent::Messages(ReceivePredicate::new(vec![
77        MessagesPredicate {
78            from: "192.168.1.11:0".parse().unwrap(),
79            to: "192.168.1.10:3000".parse().unwrap(),
80            buffer: vec![1, 1],
81        },
82    ])));
83
84    node.add_action(bind_action);
85    node.add_action(sleep_action.clone());
86    node.add_action(send_broadcast_action);
87    node.add_action(wait_connection_action);
88    node.add_action(wait_message_action);
89    node.add_action(connection_action);
90    node.add_action(send_unicast_action);
91    node.add_action(sleep_action);
92
93    node
94}
Source

pub fn event(&self) -> &WaitEvent

Trait Implementations§

Source§

impl Action for Wait

Source§

fn name(&self) -> String

Source§

fn perform<'life0, 'async_trait>( &'life0 self, ctx: Arc<Mutex<NodeContext>>, ) -> Pin<Box<dyn Future<Output = Result<(), ActionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl Clone for Wait

Source§

fn clone(&self) -> Wait

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Wait

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Wait

Source§

fn eq(&self, other: &Wait) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Wait

Auto Trait Implementations§

§

impl Freeze for Wait

§

impl RefUnwindSafe for Wait

§

impl Send for Wait

§

impl Sync for Wait

§

impl Unpin for Wait

§

impl UnsafeUnpin for Wait

§

impl UnwindSafe for Wait

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more