Struct sbp::json::Json2JsonEncoder

source ·
pub struct Json2JsonEncoder<W, F>(/* private fields */);
Expand description

Writes Json2JsonInput messages as JSON into a writer.

Implementations§

source§

impl<W, F> Json2JsonEncoder<W, F>
where W: Write, F: Formatter + Clone,

source

pub fn new(writer: W, formatter: F) -> Json2JsonEncoder<W, F>

Creates a new Json2JsonEncoder.

source

pub fn send(&mut self, message: Json2JsonInput) -> Result<(), JsonError>

Send a message to the underlying writer. If sending multiple messages at once consider using Json2JsonEncoder::send_all which buffers the writing.

source

pub fn send_all<I>(&mut self, messages: I) -> Result<(), JsonError>
where I: IntoIterator<Item = Json2JsonInput>,

Sends an iterator of messages to the underlying writer.

Trait Implementations§

source§

impl<W: Debug, F: Debug> Debug for Json2JsonEncoder<W, F>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<W, F> Freeze for Json2JsonEncoder<W, F>
where F: Freeze, W: Freeze,

§

impl<W, F> RefUnwindSafe for Json2JsonEncoder<W, F>

§

impl<W, F> Send for Json2JsonEncoder<W, F>
where F: Send, W: Send,

§

impl<W, F> Sync for Json2JsonEncoder<W, F>
where F: Sync, W: Sync,

§

impl<W, F> Unpin for Json2JsonEncoder<W, F>
where W: Unpin,

§

impl<W, F> UnwindSafe for Json2JsonEncoder<W, F>
where F: UnwindSafe, W: UnwindSafe,

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.

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, 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.