Struct minicbor::Encoder [−][src]
A non-allocating CBOR encoder writing encoded bytes to the given Write
sink.
Implementations
impl<W: Write> Encoder<W>
[src]
pub fn new(writer: W) -> Encoder<W>
[src]
Construct an Encoder
that writes to the given Write
sink.
pub fn into_inner(self) -> W
[src]
Get back the Write
impl.
pub fn encode<T: Encode>(&mut self, x: T) -> Result<&mut Self, Error<W::Error>>
[src]
Encode any type that implements Encode
.
pub fn u8(&mut self, x: u8) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a u8
value.
pub fn i8(&mut self, x: i8) -> Result<&mut Self, Error<W::Error>>
[src]
Encode an i8
value.
pub fn u16(&mut self, x: u16) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a u16
value.
pub fn i16(&mut self, x: i16) -> Result<&mut Self, Error<W::Error>>
[src]
Encode an i16
value.
pub fn u32(&mut self, x: u32) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a u32
value.
pub fn i32(&mut self, x: i32) -> Result<&mut Self, Error<W::Error>>
[src]
Encode an i32
value.
pub fn u64(&mut self, x: u64) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a u64
value.
pub fn i64(&mut self, x: i64) -> Result<&mut Self, Error<W::Error>>
[src]
Encode an i64
value.
pub fn null(&mut self) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a CBOR null
value.
pub fn undefined(&mut self) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a CBOR undefined
value.
pub fn simple(&mut self, x: u8) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a CBOR simple value.
pub fn f32(&mut self, x: f32) -> Result<&mut Self, Error<W::Error>>
[src]
Encode an f32
value.
pub fn f64(&mut self, x: f64) -> Result<&mut Self, Error<W::Error>>
[src]
Encode an f64
value.
pub fn bool(&mut self, x: bool) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a bool
value.
pub fn char(&mut self, x: char) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a char
value.
pub fn tag(&mut self, x: Tag) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a CBOR tag.
pub fn bytes(&mut self, x: &[u8]) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a byte slice.
pub fn str(&mut self, x: &str) -> Result<&mut Self, Error<W::Error>>
[src]
Encode a string slice.
pub fn array(&mut self, len: u64) -> Result<&mut Self, Error<W::Error>>
[src]
Begin encoding an array with len
elements.
pub fn map(&mut self, len: u64) -> Result<&mut Self, Error<W::Error>>
[src]
Begin encoding a map with len
entries.
pub fn begin_array(&mut self) -> Result<&mut Self, Error<W::Error>>
[src]
Begin encoding an array of unknown size.
Use Encoder::end
to terminate the array.
pub fn begin_bytes(&mut self) -> Result<&mut Self, Error<W::Error>>
[src]
Begin encoding an indefinite number of byte slices.
Use Encoder::end
to terminate.
pub fn begin_map(&mut self) -> Result<&mut Self, Error<W::Error>>
[src]
Begin encoding a map of unknown size.
Use Encoder::end
to terminate the map.
pub fn begin_str(&mut self) -> Result<&mut Self, Error<W::Error>>
[src]
Begin encoding an indefinite number of string slices.
Use Encoder::end
to terminate.
pub fn end(&mut self) -> Result<&mut Self, Error<W::Error>>
[src]
Terminate an indefinite collection.
pub fn ok(&mut self) -> Result<(), Error<W::Error>>
[src]
Syntactic sugar for Ok(())
.
Trait Implementations
impl<W> AsRef<W> for Encoder<W>
[src]
impl<W: Clone> Clone for Encoder<W>
[src]
impl<W: Debug> Debug for Encoder<W>
[src]
Auto Trait Implementations
impl<W> RefUnwindSafe for Encoder<W> where
W: RefUnwindSafe,
W: RefUnwindSafe,
impl<W> Send for Encoder<W> where
W: Send,
W: Send,
impl<W> Sync for Encoder<W> where
W: Sync,
W: Sync,
impl<W> Unpin for Encoder<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for Encoder<W> where
W: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,