pub enum SMLMessageBuilder {
    Empty,
    IncompleteStartSignature(usize),
    Recording(Vec<u8>),
    Complete {
        data: Vec<u8>,
        rest: Vec<u8>,
    },
}
Expand description

Builder to read SML messages byte-wise from a stream

use hackdose_sml_parser::transport::SMLMessageBuilder;
let mut builder = SMLMessageBuilder::Empty;
builder.record(&[0x1b, 0x1b, 0x1b, 0x1b, 0x01, 0x01, 0x01, 0x01]);
builder.record(&[0x63, 0x01, 0x02]);
builder.record(&[0x1b, 0x1b, 0x1b, 0x1b, 0x1a, 0x01,0x02, 0x03]);
assert_eq!(builder, SMLMessageBuilder::Complete{ data: vec![0x63, 0x01, 0x02], rest: vec![]});

Variants§

§

Empty

§

IncompleteStartSignature(usize)

§

Recording(Vec<u8>)

§

Complete

Fields

§data: Vec<u8>

the body of the message, omitting crc and header/footer

§rest: Vec<u8>

the unprocessed rest of the byte stream

Implementations§

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.