PendingTypes

Struct PendingTypes 

Source
pub struct PendingTypes { /* private fields */ }
Expand description

Stores information about types that are in the process of being defined.

An ISL type definition can include types that are not yet fully defined. For example, an ISL type definition might include:

  • A reference to itself. This could happen in a recursive structure like a linked list or binary tree.
  • A nested anonymous type definition.
  • A reference to type definition that is followed by current type definition. These type references will be deferred to later check if a type definition with that name exists in the schema. Because the SchemaSystem does not yet know the complete definition of these types, it cannot find them in the TypeStore. An instance of PendingTypes is used to track information about types that we do not have a complete definition for yet. When the SchemaSystem finishes loading these types, the type definitions in PendingTypes can be promoted the TypeStore.

Deferred type definition: A deferred type definition is added to PendingTypes whenever encountered type reference whose definition is outside the scope of current type definition that is being resolved. e.g. type:: { name: foo, type: bar, } type:: { name: bar, type: int }

For above example, bar will be saved as deferred type definition until we resolve the definition of bar. When the SchemaSystem finishes loading the type foo, the type definitions in PendingTypes including deferred type definitions will be promoted to the TypeStore. Once we resolve type definition for bar it will be updated in the TypeStore.

Implementations§

Source§

impl PendingTypes

Source

pub fn update_type_store( &mut self, type_store: &mut TypeStore, load_isl_import: Option<&IslImport>, isl_type_names: &HashSet<&str>, ) -> IonSchemaResult<bool>

Adds all the types from PendingTypes into given TypeStore including adding all the imported types into imports of TypeStore. It also clears PendingTypes types for loading next set of types. This method is used after a schema named type/root type is loaded entirely into PendingTypes

  • type_store - The TypeStore which will be updated with the types within this PendingType
  • load_isl_import - If this argument is Some(isl_import), then we are not within an import process of schema. Based on given enum variant isl_import we will add the types to type_store. Otherwise we will add all the types from this PendingTypes to TypeStore.
  • isl_type_names - The isl type names defined within the schema. This will be used to determine if a type definition actually exists within the schema. If a type definition from this list exists in PendingTypes it would have been added as a deferred type definition. This deferred type will be loaded into TypeStore as it is and will be replaced with a type definition once it is resolved. Returns true, if this update is not for an isl import type or it is for an isl import type but it is added to the type_store Otherwise, returns false if this update is for an isl import type and it is not yet added to the type_store.

Trait Implementations§

Source§

impl Clone for PendingTypes

Source§

fn clone(&self) -> PendingTypes

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PendingTypes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PendingTypes

Source§

fn default() -> PendingTypes

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.