Skip to main content

WriteContext

Struct WriteContext 

Source
pub struct WriteContext<'a> {
    pub writer: Writer<'a>,
    pub ref_writer: RefWriter,
    /* private fields */
}
Expand description

Serialization state container used on a single thread at a time. Sharing the same instance across threads simultaneously causes undefined behavior.

Fields§

§writer: Writer<'a>§ref_writer: RefWriter

Implementations§

Source§

impl<'a> WriteContext<'a>

Source

pub fn new(type_resolver: TypeResolver, config: Config) -> WriteContext<'a>

Source

pub fn attach_writer(&mut self, writer: Writer<'a>)

Source

pub fn detach_writer(&mut self)

Source

pub fn get_type_resolver(&self) -> &TypeResolver

Get type resolver

Source

pub fn get_type_info(&self, type_id: &TypeId) -> Result<Rc<TypeInfo>, Error>

Source

pub fn is_compatible(&self) -> bool

Check if compatible mode is enabled

Source

pub fn is_share_meta(&self) -> bool

Check if meta sharing is enabled

Source

pub fn is_compress_string(&self) -> bool

Check if string compression is enabled

Source

pub fn is_xlang(&self) -> bool

Check if cross-language mode is enabled

Source

pub fn is_check_struct_version(&self) -> bool

Check if class version checking is enabled

Source

pub fn is_track_ref(&self) -> bool

Check if reference tracking is enabled

Source

pub fn write_type_meta(&mut self, type_id: TypeId) -> Result<(), Error>

Write type meta inline using streaming protocol. Writes index marker with LSB indicating new type or reference.

Source

pub fn write_any_type_info( &mut self, fory_type_id: u32, concrete_type_id: TypeId, ) -> Result<Rc<TypeInfo>, Error>

Source

pub fn write_meta_string_bytes( &mut self, ms: Rc<MetaString>, ) -> Result<(), Error>

Source

pub fn reset(&mut self)

Trait Implementations§

Source§

impl<'a> Drop for WriteContext<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a> Send for WriteContext<'a>

Source§

impl<'a> Sync for WriteContext<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for WriteContext<'a>

§

impl<'a> RefUnwindSafe for WriteContext<'a>

§

impl<'a> Unpin for WriteContext<'a>

§

impl<'a> !UnwindSafe for WriteContext<'a>

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.