Struct blather::types::kvlines::KVLines

source ·
pub struct KVLines { /* private fields */ }
Expand description

Ordered list of key/value pairs, with no uniqueness constraint for the keys.

Implementations§

source§

impl KVLines

source

pub fn new() -> Self

Create a new empty parameters object.

source

pub fn clear(&mut self)

Reset all the lines.

source

pub fn get_inner(&self) -> &Vec<KeyValue>

Get a reference to the inner vector of KeyValue’s.

source

pub fn append<T: ToString, U: ToString>(&mut self, key: T, value: U)

Append a key/value entry to the end of the list.

source

pub fn calc_buf_size(&self) -> usize

Calculate the size of the buffer in serialized form. Each entry will be a newline terminated utf-8 line. Last line will be a single newline character.

source

pub fn serialize(&self) -> Result<Vec<u8>, Error>

Serialize object into a Vec<u8> buffer suitable for transmission.

source

pub fn encoder_write(&self, buf: &mut BytesMut) -> Result<(), Error>

Write the Params to a buffer.

source

pub fn into_inner(self) -> Vec<KeyValue>

Consume the Params buffer and return the internal key/value list as a Vec<KeyValue>

Trait Implementations§

source§

impl Clone for KVLines

source§

fn clone(&self) -> KVLines

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for KVLines

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for KVLines

source§

fn default() -> KVLines

Returns the “default value” for a type. Read more
source§

impl Display for KVLines

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Encoder<&KVLines> for Codec

§

type Error = Error

The type of encoding errors. Read more
source§

fn encode(&mut self, kvlines: &KVLines, buf: &mut BytesMut) -> Result<(), Error>

Encodes a frame into the buffer provided. Read more
source§

impl From<Vec<(String, String)>> for KVLines

source§

fn from(lines: Vec<(String, String)>) -> Self

Converts to this type from the input type.
source§

impl From<Vec<KeyValue>> for KVLines

source§

fn from(lines: Vec<KeyValue>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more