Skip to main content

ReadContext

Struct ReadContext 

Source
pub struct ReadContext<'a> {
    pub reader: Reader<'a>,
    pub meta_resolver: MetaReaderResolver,
    pub ref_reader: RefReader,
    /* private fields */
}
Expand description

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

Fields§

§reader: Reader<'a>§meta_resolver: MetaReaderResolver§ref_reader: RefReader

Implementations§

Source§

impl<'a> ReadContext<'a>

Source

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

Source

pub fn get_type_resolver(&self) -> &TypeResolver

Get type resolver

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_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 max_dyn_depth(&self) -> u32

Get maximum dynamic depth

Source

pub fn attach_reader(&mut self, reader: Reader<'a>)

Source

pub fn detach_reader(&mut self) -> Reader<'_>

Source

pub fn get_type_info_by_index( &self, type_index: usize, ) -> Result<&Rc<TypeInfo>, Error>

Source

pub fn get_meta(&self, type_index: usize) -> Result<&Rc<TypeInfo>, Error>

Source

pub fn read_type_meta(&mut self) -> Result<Rc<TypeInfo>, Error>

Read type meta inline using streaming protocol. Returns the TypeInfo for this type.

Source

pub fn read_any_type_info(&mut self) -> Result<Rc<TypeInfo>, Error>

Source

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

Source

pub fn read_meta_string(&mut self) -> Result<&MetaString, Error>

Source

pub fn inc_depth(&mut self) -> Result<(), Error>

Source

pub fn dec_depth(&mut self)

Source

pub fn reset(&mut self)

Trait Implementations§

Source§

impl<'a> Send for ReadContext<'a>

Source§

impl<'a> Sync for ReadContext<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ReadContext<'a>

§

impl<'a> !RefUnwindSafe for ReadContext<'a>

§

impl<'a> Unpin for ReadContext<'a>

§

impl<'a> !UnwindSafe for ReadContext<'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.