Skip to main content

PickleEncoder

Struct PickleEncoder 

Source
pub struct PickleEncoder<W: Write> { /* private fields */ }
Expand description

Streaming pickle (protocol 2) encoder.

Implementations§

Source§

impl<W: Write> PickleEncoder<W>

Source

pub fn new(writer: W) -> Self

Create a pickle encoder over writer.

Source

pub fn finish(self) -> Result<W>

Flush the internal buffer and return the underlying writer.

Trait Implementations§

Source§

impl<W: Write> FormatEncoder for PickleEncoder<W>

Source§

type Error = Error

The error type produced by this format’s methods. Read more
Source§

fn begin_array(&mut self) -> Result<(), Self::Error>

Begin an array container.
Source§

fn separator(&mut self) -> Result<(), Self::Error>

Emit the separator preceding a subsequent array element. Read more
Source§

fn end_array(&mut self) -> Result<(), Self::Error>

End the current array container.
Source§

fn begin_object(&mut self) -> Result<(), Self::Error>

Begin an object container.
Source§

fn key(&mut self, key: &str) -> Result<(), Self::Error>

Emit an object key. Read more
Source§

fn end_object(&mut self) -> Result<(), Self::Error>

End the current object container.
Source§

fn write_null(&mut self) -> Result<(), Self::Error>

Emit null.
Source§

fn write_bool(&mut self, value: bool) -> Result<(), Self::Error>

Emit a boolean.
Source§

fn write_str(&mut self, value: &str) -> Result<(), Self::Error>

Emit a UTF-8 string.
Source§

fn write_char(&mut self, value: char) -> Result<(), Self::Error>

Emit a single character (a one-scalar string).
Source§

fn write_number(&mut self, value: &Number) -> Result<(), Self::Error>

Emit a number preserving its exact internal kind.
Source§

fn write_i64(&mut self, value: i64) -> Result<(), Self::Error>

Emit an i64.
Source§

fn write_u64(&mut self, value: u64) -> Result<(), Self::Error>

Emit a u64.
Source§

fn write_i128(&mut self, value: i128) -> Result<(), Self::Error>

Emit an i128.
Source§

fn write_u128(&mut self, value: u128) -> Result<(), Self::Error>

Emit a u128.
Source§

fn write_f64(&mut self, value: f64) -> Result<(), Self::Error>

Emit an f64 (shortest round-trip).
Source§

fn write_f32(&mut self, value: f32) -> Result<(), Self::Error>

Emit an f32 (shortest round-trip).
Source§

fn write_bytes(&mut self, value: &[u8]) -> Result<(), Self::Error>

Emit a byte sequence. Read more
Source§

fn is_human_readable(&self) -> bool

Whether this format produces human-readable output. Read more
Source§

fn write_i8(&mut self, value: i8) -> Result<(), Self::Error>

Emit an i8 (default: widen to write_i64). Read more
Source§

fn write_i16(&mut self, value: i16) -> Result<(), Self::Error>

Emit an i16 (default: widen to write_i64).
Source§

fn write_i32(&mut self, value: i32) -> Result<(), Self::Error>

Emit an i32 (default: widen to write_i64).
Source§

fn write_u8(&mut self, value: u8) -> Result<(), Self::Error>

Emit a u8 (default: widen to write_u64).
Source§

fn write_u16(&mut self, value: u16) -> Result<(), Self::Error>

Emit a u16 (default: widen to write_u64).
Source§

fn write_u32(&mut self, value: u32) -> Result<(), Self::Error>

Emit a u32 (default: widen to write_u64).
Source§

fn write_none(&mut self) -> Result<(), Self::Error>

Emit Option::None. Read more
Source§

fn write_some(&mut self) -> Result<(), Self::Error>

Emit the marker that the following value is Option::Some. Read more
Source§

fn map_key<K: NsonSerialize>(&mut self, key: &K) -> Result<(), Self::Error>

Emit a map key. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<W> UnsafeUnpin for PickleEncoder<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for PickleEncoder<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.