pub struct Wait { /* private fields */ }Implementations§
Source§impl Wait
impl Wait
Sourcepub fn new(event: WaitEvent) -> Self
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}pub fn event(&self) -> &WaitEvent
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more