pub struct Encoder<W: Write> { /* private fields */ }Implementations§
Source§impl<W: Write> Encoder<W>
impl<W: Write> Encoder<W>
pub fn write_null(&mut self) -> Result<Offset>
pub fn write_bool(&mut self, b: bool) -> Result<Offset>
pub fn write_ref(&mut self, p: Offset) -> Result<Offset>
pub fn write_pointer(&mut self, p: Offset) -> Result<Offset>
pub fn write_f32(&mut self, f: f32) -> Result<Offset>
pub fn write_f64(&mut self, f: f64) -> Result<Offset>
Sourcepub fn write_string(&mut self, s: &str) -> Result<Offset>
pub fn write_string(&mut self, s: &str) -> Result<Offset>
Write a unicode string.
Sourcepub fn write_bytes(&mut self, b: &[u8]) -> Result<Offset>
pub fn write_bytes(&mut self, b: &[u8]) -> Result<Offset>
Write a binary blob.
Sourcepub fn write_variant0(&mut self, c: VariantIdx) -> Result<Offset>
pub fn write_variant0(&mut self, c: VariantIdx) -> Result<Offset>
Write a nullary variant.
Sourcepub fn write_immediate(&mut self, imm: Immediate<'_>) -> Result<Offset>
pub fn write_immediate(&mut self, imm: Immediate<'_>) -> Result<Offset>
Write an immediate value.
Sourcepub fn write_immediate_or_return_pointer(
&mut self,
imm: Immediate<'_>,
) -> Result<Offset>
pub fn write_immediate_or_return_pointer( &mut self, imm: Immediate<'_>, ) -> Result<Offset>
Write the immediate; but if it’s a pointer, return the pointer without writing a thing.
pub fn write_tag(&mut self, tag: Tag, v: Immediate<'_>) -> Result<Offset>
Sourcepub fn write_array(&mut self, arr: &[Immediate<'_>]) -> Result<Offset>
pub fn write_array(&mut self, arr: &[Immediate<'_>]) -> Result<Offset>
Write an array.
The values in the array must be converted to immediates already, possibly by way of writing them first and making pointers to their written representation.
Sourcepub fn write_map(
&mut self,
map: &[(Immediate<'_>, Immediate<'_>)],
) -> Result<Offset>
pub fn write_map( &mut self, map: &[(Immediate<'_>, Immediate<'_>)], ) -> Result<Offset>
Write a map. Keys and values must already be encoded into immediates.
Sourcepub fn write_variant(
&mut self,
c: VariantIdx,
args: &[Immediate<'_>],
) -> Result<Immediate<'static>>
pub fn write_variant( &mut self, c: VariantIdx, args: &[Immediate<'_>], ) -> Result<Immediate<'static>>
Write a variant c with arguments args.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more