Struct Encoder

Source
pub struct Encoder<W> { /* private fields */ }
Expand description

The actual encoder type definition

Implementations§

Source§

impl<W: WriteBytesExt> Encoder<W>

Source

pub fn new(w: W) -> Encoder<W>

Source

pub fn into_writer(self) -> W

Source

pub fn writer(&mut self) -> &mut W

Source

pub fn u8(&mut self, x: u8) -> EncodeResult

Source

pub fn u16(&mut self, x: u16) -> EncodeResult

Source

pub fn u32(&mut self, x: u32) -> EncodeResult

Source

pub fn u64(&mut self, x: u64) -> EncodeResult

Source

pub fn i8(&mut self, x: i8) -> EncodeResult

Source

pub fn i16(&mut self, x: i16) -> EncodeResult

Source

pub fn i32(&mut self, x: i32) -> EncodeResult

Source

pub fn i64(&mut self, x: i64) -> EncodeResult

Source

pub fn int(&mut self, x: Int) -> EncodeResult

Source

pub fn f32(&mut self, x: f32) -> EncodeResult

Source

pub fn f64(&mut self, x: f64) -> EncodeResult

Source

pub fn bool(&mut self, x: bool) -> EncodeResult

Source

pub fn simple(&mut self, x: Simple) -> EncodeResult

Source

pub fn bytes(&mut self, x: &[u8]) -> EncodeResult

Source

pub fn bytes_iter<'r, I: Iterator<Item = &'r [u8]>>( &mut self, iter: I, ) -> EncodeResult

Indefinite byte string encoding. (RFC 7049 section 2.2.2)

Source

pub fn text(&mut self, x: &str) -> EncodeResult

Source

pub fn text_iter<'r, I: Iterator<Item = &'r str>>( &mut self, iter: I, ) -> EncodeResult

Indefinite string encoding. (RFC 7049 section 2.2.2)

Source

pub fn null(&mut self) -> EncodeResult

Source

pub fn undefined(&mut self) -> EncodeResult

Source

pub fn tag(&mut self, x: Tag) -> EncodeResult

Source

pub fn array(&mut self, len: usize) -> EncodeResult

Source

pub fn array_begin(&mut self) -> EncodeResult

Indefinite array encoding. (RFC 7049 section 2.2.1)

Source

pub fn array_end(&mut self) -> EncodeResult

End of indefinite array encoding. (RFC 7049 section 2.2.1)

Source

pub fn object(&mut self, len: usize) -> EncodeResult

Source

pub fn object_begin(&mut self) -> EncodeResult

Indefinite object encoding. (RFC 7049 section 2.2.1)

Source

pub fn object_end(&mut self) -> EncodeResult

End of indefinite object encoding. (RFC 7049 section 2.2.1)

Auto Trait Implementations§

§

impl<W> Freeze for Encoder<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for Encoder<W>
where W: RefUnwindSafe,

§

impl<W> Send for Encoder<W>
where W: Send,

§

impl<W> Sync for Encoder<W>
where W: Sync,

§

impl<W> Unpin for Encoder<W>
where W: Unpin,

§

impl<W> UnwindSafe for Encoder<W>
where 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>,

Source§

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

Source§

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.