pub struct SizedSequence<T, S, F>(pub F, pub T) 
where
    T: IntoIterator,
    T::Item: WriteInto,
    T::IntoIter: ExactSizeIterator,
    S: WriteInto,
    F: FnOnce(usize) -> S
;
Expand description

Used to write values from IntoIterator with known size.

Example

use write_into::{BigEndian, SizedSequence, write_into};

let mut buffer = Vec::new();
let written = write_into(&mut buffer, SizedSequence(|size| BigEndian(size as u16), &[
    BigEndian(0xAABBu16),
    BigEndian(0xCCDDu16),
])).unwrap();
assert_eq!(written, 2);
assert_eq!(&buffer, &[0x00, 0x02, 0xAA, 0xBB, 0xCC, 0xDD]);

Tuple Fields

0: F1: T

Trait Implementations

Returns how many items was written.

Result of WriteInto::write_into function (e.g. () or usize).

Writes value into I/O sink.

Returns how many items was written.

Result of WriteInto::write_into function (e.g. () or usize).

Writes value into I/O sink.

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.