Struct Writer
pub struct Writer<S> {
sink: S,
}Expand description
Writes MQTT wire-format fields into a Sink.
Every method fails only with the sink’s error. A failed method can leave part of its field in the sink.
Fields§
§sink: SImplementations§
§impl<S: Sink> Writer<S>
impl<S: Sink> Writer<S>
pub const fn new(sink: S) -> Self
pub const fn new(sink: S) -> Self
Creates a writer over sink.
pub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Returns the sink.
pub fn vbi(&mut self, value: Vbi) -> Result<(), S::Error>
pub fn vbi(&mut self, value: Vbi) -> Result<(), S::Error>
Writes a Variable Byte Integer (1-4 bytes).
§Errors
Returns the sink’s error if it cannot take the encoded value.
pub fn binary(&mut self, data: &MqttBytes) -> Result<(), S::Error>
pub fn binary(&mut self, data: &MqttBytes) -> Result<(), S::Error>
Writes length-prefixed binary data.
§Errors
Returns the sink’s error if it cannot take the prefix and data.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Writer<S>where
S: Freeze,
impl<S> RefUnwindSafe for Writer<S>where
S: RefUnwindSafe,
impl<S> Send for Writer<S>where
S: Send,
impl<S> Sync for Writer<S>where
S: Sync,
impl<S> Unpin for Writer<S>where
S: Unpin,
impl<S> UnsafeUnpin for Writer<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Writer<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more