Expand description
Stream abstraction for rotor
The crate provides:
- Buffering for network sockets
- Simple abstractions like read N bytes, read until ‘\n’
- Persistent (auto-reconnecting) client connections
- Abstraction for accepting connection on server-side
Assumptions for streams:
- You read data by length-prefixed or fixed-string-delimited chunks rather than byte-by-byte
- Each chunk fits memory
- Your data stream is not entirely full-duplex: while you can read and write simultaneously, when you apply pushback (i.e. waiting for bytes to be flushed), you can’t do reads [*]
[*] This matches HTTP perfectly, and most bidirectional interactive workflows (including based on websockets). But for some cases may be hard to implement. One such case is when you need to generate some output stream (you can’t buffer it), and have to parse input stream at the same time.
Structs§
- A buffer object to be used for reading from network
- A structure that encapsulates a state machine and an expectation
- A helper class returned from
Intent::of()
- Persistent client connection
- Protocol returned None right at the start of the stream processing
- A main stream state machine abstaction
- Transport is thing that provides buffered I/O for stream sockets
Enums§
- Socket acceptor State Machine
- An exception value that is received in
Protocol::exception
method - This is an enumeration used to declare what next protocol is expecting
Constants§
- Maximum size of buffer allowed. Note: we assert on this size. Most network servers should set their own limits to something much smaller.
Traits§
- Trait which must be implemented for a state machine to accept connection