pub struct ValueWriter<'c, 'o> { /* private fields */ }Expand description
Writes values at their types into a buffer: the runtime’s own values
(write_value), and a Rust value its Shaped
mapping writes part by part, with no runtime value between.
Implementations§
Source§impl<'c> ValueWriter<'c, '_>
impl<'c> ValueWriter<'c, '_>
Sourcepub fn refuse(&self, ty: &Type) -> EncodeError
pub fn refuse(&self, ty: &Type) -> EncodeError
The refusal of a value written at ty, a type the Rust type does
not map to.
Sourcepub fn list<'v, T: Shaped>(
&mut self,
ty: &Type,
items: impl ExactSizeIterator<Item = &'v T>,
) -> Result<(), EncodeError>
pub fn list<'v, T: Shaped>( &mut self, ty: &Type, items: impl ExactSizeIterator<Item = &'v T>, ) -> Result<(), EncodeError>
Sourcepub fn set<'v, T: Shaped>(
&mut self,
ty: &Type,
items: impl ExactSizeIterator<Item = &'v T>,
) -> Result<(), EncodeError>
pub fn set<'v, T: Shaped>( &mut self, ty: &Type, items: impl ExactSizeIterator<Item = &'v T>, ) -> Result<(), EncodeError>
Writes a set of items, in Flow’s order of them.
§Errors
When ty is no set, an item is not of its element type, or two
items are one value.
Sourcepub fn dict<'v, K: Shaped, V: Shaped>(
&mut self,
ty: &Type,
entries: impl ExactSizeIterator<Item = (&'v K, &'v V)>,
) -> Result<(), EncodeError>
pub fn dict<'v, K: Shaped, V: Shaped>( &mut self, ty: &Type, entries: impl ExactSizeIterator<Item = (&'v K, &'v V)>, ) -> Result<(), EncodeError>
Writes a dictionary of entries, in Flow’s order of their keys.
§Errors
When ty is no dictionary, a key or a value is not of its type, or
two keys are one value.
Sourcepub fn tuple(
&mut self,
ty: &Type,
parts: &[&dyn Part],
) -> Result<(), EncodeError>
pub fn tuple( &mut self, ty: &Type, parts: &[&dyn Part], ) -> Result<(), EncodeError>
Writes a tuple of parts.
§Errors
When ty is no tuple of as many parts, or a part is not of its type.
Sourcepub fn record(
&mut self,
ty: &Type,
fields: &[&dyn Part],
) -> Result<(), EncodeError>
pub fn record( &mut self, ty: &Type, fields: &[&dyn Part], ) -> Result<(), EncodeError>
Writes a record of fields, in declaration order.
§Errors
When ty is no record of as many fields, or a field is not of its
type.
Sourcepub fn variant(
&mut self,
ty: &Type,
index: usize,
payload: &[&dyn Part],
) -> Result<(), EncodeError>
pub fn variant( &mut self, ty: &Type, index: usize, payload: &[&dyn Part], ) -> Result<(), EncodeError>
Writes the value of the constructor at index of the enum ty,
Option and Result included, with payload.
§Errors
When ty is no enum with that constructor taking as many parts, or
a part is not of its type.