Struct libdonet::dcfile::DCFile

source ·
pub struct DCFile<'dc> {
    baked_hash: DCFileHash,
    structs: Vec<DCStruct>,
    dclasses: Vec<DClass<'dc>>,
    imports: Vec<PyModuleImport>,
    keywords: Vec<DCKeyword>,
    type_defs: Vec<DCTypeDefinition>,
    field_id_2_field: Vec<&'dc DCField<'dc>>,
    all_object_valid: bool,
    inherited_fields_stale: bool,
}
Expand description

Data model that provides a high level representation of a single, or collection, of DC files and their elements such as class imports, type definitions, structures, and Distributed Classes.

Fields§

§baked_hash: DCFileHash§structs: Vec<DCStruct>§dclasses: Vec<DClass<'dc>>§imports: Vec<PyModuleImport>§keywords: Vec<DCKeyword>§type_defs: Vec<DCTypeDefinition>§field_id_2_field: Vec<&'dc DCField<'dc>>§all_object_valid: bool§inherited_fields_stale: bool

Implementations§

source§

impl<'dc> DCFile<'dc>

source

pub(crate) fn new( structs: Vec<DCStruct>, dclasses: Vec<DClass<'dc>>, imports: Vec<PyModuleImport>, keywords: Vec<DCKeyword>, type_defs: Vec<DCTypeDefinition>, field_id_2_field: Vec<&'dc DCField<'dc>>, all_object_valid: bool, inherited_fields_stale: bool, ) -> Self

source

pub fn get_hash(&self) -> DCFileHash

Returns a 32-bit hash index associated with this file. This number is guaranteed to be consistent if the contents of the file have not changed, and it is very likely to be different if the contents of the file do change.

If called more than once, it will reuse the already calculated hash, as this structure is guaranteed to be immutable after initialization.

source

pub fn get_pretty_hash(&self) -> String

Returns a string with the hash as a pretty format hexadecimal.

source

pub fn get_num_imports(&self) -> usize

source

pub fn get_python_import(&self, index: usize) -> PyModuleImport

source

pub fn get_num_keywords(&self) -> usize

source

pub fn get_keyword(&self, _index: usize) -> &'dc DCKeyword

source

pub fn has_keyword(&self, _keyword: String) -> bool

source

pub fn get_num_dclasses(&self) -> usize

source

pub fn get_dclass(&self, _index: usize) -> &'dc DClass<'_>

source

pub fn get_dclass_by_id(&self, id: DClassId) -> &'dc DClass<'_>

source

pub fn get_dclass_by_name(&self, _name: &str) -> &'dc DClass<'_>

source

pub fn get_num_structs(&self) -> usize

source

pub fn get_struct(&self, _index: usize) -> &'dc DCStruct

Trait Implementations§

source§

impl<'dc> DCHash for DCFile<'dc>

source§

fn generate_hash(&self, hashgen: &mut DCHashGenerator)

Accumulates the properties of this DC element into the file hash.
source§

impl<'dc> Debug for DCFile<'dc>

source§

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

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

impl<'dc> Display for DCFile<'dc>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'dc> Freeze for DCFile<'dc>

§

impl<'dc> !RefUnwindSafe for DCFile<'dc>

§

impl<'dc> !Send for DCFile<'dc>

§

impl<'dc> !Sync for DCFile<'dc>

§

impl<'dc> Unpin for DCFile<'dc>

§

impl<'dc> !UnwindSafe for DCFile<'dc>

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.