Struct rotor_stream::Intent [] [src]

pub struct Intent<M>(_, _, _);

A structure that encapsulates a state machine and an expectation

It's usually built with a builder that starts with Intent::of(machine).

Then you add an expectation:

Intent::of(machine).expect_delimiter("\n", 1024)

And then you may add a timeout (in form of "deadline" or "absolute time"):

Intent::of(machine).expect_bytes(100)
    .deadline(scope.now() + Duration::new(10, 0))

Methods

impl<M> Intent<M>

fn of(machine: M) -> IntentBuilder<M>

Start building the Intent object of the state machine

fn done() -> Self

Notifies that state machine has done it's work

fn error(e: Box<Error>) -> Self

Notifies that we have protocol error and connection should be closed

fn deadline(self, deadline: Time) -> Intent<M>

Add/change the deadline

Note: if you skip this method on next return timeout will be reset. Which means this state machine may hang indefinitely.

fn deadline_opt(self, deadline: Option<Time>) -> Intent<M>

Add/change the deadline as an optional value

Note this will reset timeout if deadline is None, not keep unchanged

Trait Implementations

Derived Implementations

impl<M: Debug> Debug for Intent<M>

fn fmt(&self, __arg_0: &mut Formatter) -> Result