pub struct CiStack { /* private fields */ }Expand description
The composed EN 50221 protocol core.
Implementations§
Source§impl CiStack
impl CiStack
Sourcepub fn new(bounds: StackBounds) -> Self
pub fn new(bounds: StackBounds) -> Self
New stack on transport connection t_c_id = 1, running on the caller’s bounds. The host
advertises the Resource Manager and registers the RM + application_information +
conditional_access handlers.
Examples found in repository?
examples/sans_io_core.rs (line 40)
39fn main() {
40 let mut stack = CiStack::new(stack_bounds());
41
42 // Host brings the interface up: reset + query slot + open transport.
43 show("Init", &stack.handle(Event::Host(HostRequest::Init)));
44
45 // Module accepts the transport connection.
46 let reply = [tags::C_T_C_REPLY, 0x01, 0x01];
47 show(
48 "Readable(C_T_C_Reply)",
49 &stack.handle(Event::Readable(&reply)),
50 );
51
52 // A timer tick with no inbound data drives the poll cadence
53 // (an empty T_Data_Last down to the module).
54 show(
55 "Tick(100ms)",
56 &stack.handle(Event::Tick {
57 elapsed: Duration::from_millis(100),
58 }),
59 );
60}Sourcepub fn register(&mut self, resource: Box<dyn Resource>) -> &mut Self
pub fn register(&mut self, resource: Box<dyn Resource>) -> &mut Self
Register an additional resource handler.
Sourcepub fn handle(&mut self, event: Event<'_>) -> Vec<Action>
pub fn handle(&mut self, event: Event<'_>) -> Vec<Action>
The pure sans-IO entry point.
Examples found in repository?
examples/sans_io_core.rs (line 43)
39fn main() {
40 let mut stack = CiStack::new(stack_bounds());
41
42 // Host brings the interface up: reset + query slot + open transport.
43 show("Init", &stack.handle(Event::Host(HostRequest::Init)));
44
45 // Module accepts the transport connection.
46 let reply = [tags::C_T_C_REPLY, 0x01, 0x01];
47 show(
48 "Readable(C_T_C_Reply)",
49 &stack.handle(Event::Readable(&reply)),
50 );
51
52 // A timer tick with no inbound data drives the poll cadence
53 // (an empty T_Data_Last down to the module).
54 show(
55 "Tick(100ms)",
56 &stack.handle(Event::Tick {
57 elapsed: Duration::from_millis(100),
58 }),
59 );
60}Auto Trait Implementations§
impl !RefUnwindSafe for CiStack
impl !Send for CiStack
impl !Sync for CiStack
impl !UnwindSafe for CiStack
impl Forget for CiStack
impl Freeze for CiStackwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Vec<u8>>: Freeze,
*const LeafNode<u16, ResourceId> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(u16, ResourceId)>>: Freeze,
PhantomData<Box<dyn Resource>>: Freeze,
PhantomData<ResourceId>: Freeze,
PhantomData<u16>: Freeze,
impl Move for CiStack
impl Unpin for CiStack
impl UnsafeUnpin for CiStackwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Vec<u8>>: UnsafeUnpin,
*const LeafNode<u16, ResourceId> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(u16, ResourceId)>>: UnsafeUnpin,
PhantomData<Box<dyn Resource>>: UnsafeUnpin,
PhantomData<ResourceId>: UnsafeUnpin,
PhantomData<u16>: UnsafeUnpin,
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