Skip to main content

TypedObjectWriter

Struct TypedObjectWriter 

Source
pub struct TypedObjectWriter<'a, 'b> { /* private fields */ }
Expand description

A writer for encoding the contents of a typed child object

Implementations§

Source§

impl TypedObjectWriter<'_, '_>

Source

pub fn commit<T: AsRef<str>>(self, name: T)

Finalise this typed object, adding it to its parent If this is not called, the object will not be added

Trait Implementations§

Source§

impl<'a> ObjWriter<'a> for TypedObjectWriter<'a, '_>

Source§

fn add_element(&mut self, name: &str, s: Value, inc_ref: bool)

Add an element to this object
Source§

fn object<'c: 'a, 'd>( &'d mut self, cache_key: CacheKey, ) -> (Option<ObjectWriter<'d, 'c>>, Reference)
where 'a: 'c + 'd,

Create a writer that can serialize an object Read more
Source§

fn array<'c: 'a, 'd>( &'d mut self, cache_key: CacheKey, ) -> (Option<ArrayWriter<'d, 'c>>, Reference)
where 'a: 'c + 'd,

Create a writer that can serialize an array Read more
Source§

fn strict_array<'c: 'a, 'd>( &'d mut self, cache_key: CacheKey, ) -> (Option<StrictArrayWriter<'d, 'c>>, Reference)
where 'a: 'c + 'd,

Create a writer that can serialize a strict array Read more
Source§

fn typed_object<'c: 'a, 'd>( &'d mut self, class_name: &str, cache_key: CacheKey, ) -> (Option<TypedObjectWriter<'d, 'c>>, Reference)
where 'a: 'c + 'd,

Typed objects can also be sent cached Create a writer that can serialize a typed object Read more
Source§

fn make_reference(&mut self) -> Reference

Create a reference in the root
Source§

fn cache_get(&mut self, cache_key: &CacheKey) -> Option<Reference>

Retrieve a reference from the cache
Source§

fn cache_add(&mut self, cache_key: CacheKey, reference: Reference)

Add a reference to the reference cache
Source§

fn string(&mut self, name: &str, s: &str)

Write a string
Source§

fn number(&mut self, name: &str, s: f64)

Write a number
Source§

fn reference(&mut self, name: &str, v: Reference)

Write a reference
Source§

fn undefined(&mut self, name: &str)

Write an undefined
Source§

fn null(&mut self, name: &str)

Write a null
Source§

fn bool(&mut self, name: &str, v: bool)

Write a bool
Source§

fn date(&mut self, name: &str, time: f64, timezone_or_utc: Option<u16>)

Write a date
Source§

fn xml(&mut self, name: &str, v: &str, is_string: bool)

Write an XML

Auto Trait Implementations§

§

impl<'a, 'b> !RefUnwindSafe for TypedObjectWriter<'a, 'b>

§

impl<'a, 'b> !Send for TypedObjectWriter<'a, 'b>

§

impl<'a, 'b> !Sync for TypedObjectWriter<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for TypedObjectWriter<'a, 'b>

§

impl<'a, 'b> Freeze for TypedObjectWriter<'a, 'b>

§

impl<'a, 'b> Unpin for TypedObjectWriter<'a, 'b>

§

impl<'a, 'b> UnsafeUnpin for TypedObjectWriter<'a, 'b>

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.