pub trait SectionBuilder: Sized {
Show 13 methods
// Required methods
fn into_target(self) -> MessageTarget;
fn get_target(&self) -> &MessageTarget;
fn get_target_mut(&mut self) -> &mut MessageTarget;
// Provided methods
fn set_limit(&mut self, limit: usize) { ... }
fn header(&self) -> &Header { ... }
fn header_mut(&mut self) -> &mut Header { ... }
fn preview(&self) -> &[u8] ⓘ { ... }
fn prelude(&self) -> &[u8] ⓘ { ... }
fn prelude_mut(&mut self) -> &mut [u8] ⓘ { ... }
fn finish(self) -> BytesMut { ... }
fn freeze(self) -> Message { ... }
fn snapshot(&self) -> Snapshot<Self> { ... }
fn rewind(&mut self, snapshot: &Snapshot<Self>) { ... }
}
Expand description
Trait that implements common interface for building message sections
Required Methods§
Sourcefn into_target(self) -> MessageTarget
fn into_target(self) -> MessageTarget
Converts into target
Sourcefn get_target(&self) -> &MessageTarget
fn get_target(&self) -> &MessageTarget
Returns message target
Sourcefn get_target_mut(&mut self) -> &mut MessageTarget
fn get_target_mut(&mut self) -> &mut MessageTarget
Returns message target
Provided Methods§
Sourcefn set_limit(&mut self, limit: usize)
fn set_limit(&mut self, limit: usize)
Updates the message’s size limit.
After this method was called, additional data will not be added to the
message if that would result in the message exceeding a size of
limit
bytes. If the message is already larger than limit
when the
method is called, it will not be truncated. That is, you can never
actually set a limit smaller than the current message size.
Note also that the limit only regards the message constructed by the builder itself. If a builder was created atop a buffer that already contained some data, this pre-existing data is not considered.
Sourcefn header_mut(&mut self) -> &mut Header
fn header_mut(&mut self) -> &mut Header
Returns a mutable reference to the messages header.
Sourcefn preview(&self) -> &[u8] ⓘ
fn preview(&self) -> &[u8] ⓘ
Returns a reference to the message assembled so far.
In case the builder was created from a buffer with pre-existing content, the returned reference is for the complete content of this buffer.
Sourcefn prelude(&self) -> &[u8] ⓘ
fn prelude(&self) -> &[u8] ⓘ
Returns a reference to the slice preceeding the message.
The slice is may be empty.
Sourcefn prelude_mut(&mut self) -> &mut [u8] ⓘ
fn prelude_mut(&mut self) -> &mut [u8] ⓘ
Returns a mutable reference to the slice preceeding the message.
Sourcefn finish(self) -> BytesMut
fn finish(self) -> BytesMut
Finishes the message and returns the underlying bytes buffer.
This will result in a message with empty authority and additional sections.
Sourcefn freeze(self) -> Message
fn freeze(self) -> Message
Finishes the message and returns the resulting bytes value.
This will result in a message with empty authority and additional sections.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.