Enum rotor_stream::Expectation
[−]
[src]
pub enum Expectation { Bytes(usize), Delimiter(usize, &'static [u8], usize), Flush(usize), Sleep, }
This is an enumeration used to declare what next protocol is expecting
The value is used in Intent::expect()
.
Most users should use IntentBuilder
's (a type which is returned from
Intent::of(..)
) methods. But for some kinds of control flow being
able to specify expectation as a separate enum is very useful.
Variants
Bytes | Read number of bytes The buffer that is passed to bytes_read might contain more bytes, but
Note that bytes passed here is neither limit on bytes actually read from the network (we resize buffer as convenient for memory allocator and read as much as possible), nor is the preallocated buffer size (we don't preallocate the buffer to be less vulnerable to DoS attacks). Note that real number of bytes that | |
Delimiter | Read until delimiter Parameters: Only static strings are supported for delimiter now.
| |
Flush | Wait until no more than N bytes is in output buffer This is going to be used for several cases:
| |
Sleep | Wait until deadline This useful for two cases:
|