Skip to main content

Document

Struct Document 

Source
pub struct Document {
Show 26 fields pub file_guid: [u8; 16], pub root_type: String, pub data_start: usize, pub data_end: usize, pub arrays_offset: u32, pub boxed_values_offset: u32, pub strings_offset: u32, pub serialized_layout: bool, pub hashed_reflection_names: bool, pub reflection_data: Vec<u8>, pub fixup_type_guids: Vec<[u8; 16]>, pub fixup_type_signatures: Vec<u32>, pub boxed_reference_offsets: Vec<u32>, pub types: Vec<TypeDescriptor>, pub fields: Vec<FieldDescriptor>, pub instances: Vec<Instance>, pub imports: Vec<ImportReference>, pub arrays: Vec<ArrayRecord>, pub boxed_values: Vec<BoxedValueRecord>, pub pointer_offsets: Vec<u32>, pub resource_ref_offsets: Vec<u32>, pub import_offsets: Vec<u32>, pub type_info_offsets: Vec<u32>, pub boxed_value_slots: Vec<u32>, pub payload: Vec<u8>, pub reflection_groups: Vec<ReflectionGroup>,
}
Expand description

An EBX document read by read: its instances with typed values, together with the reflection data, fixup tables and payload that write() needs to lay it out again.

Fields§

§file_guid: [u8; 16]

The document’s own GUID (the first 16 bytes of the EFIX chunk); other documents import it by this.

§root_type: String

Name of the first instance’s type.

§data_start: usize

Absolute offsets of the EBXD payload in the bytes read.

§data_end: usize

Absolute offset of the end of the EBXD payload in the bytes read.

§arrays_offset: u32

Offset of the EBXX array section, from the start of the payload (EFIX).

§boxed_values_offset: u32

Offset of the boxed-value section, from the start of the payload (EFIX).

§strings_offset: u32

Offset of the string section, from the start of the payload (EFIX).

§serialized_layout: bool

Whether the RIFF form is EBXS rather than EBX.

§hashed_reflection_names: bool

Whether the reflection chunk is RFL2 (names looked up by hash) rather than REFL.

§reflection_data: Vec<u8>

The reflection chunk (REFL or RFL2) as stored.

§fixup_type_guids: Vec<[u8; 16]>

The GUIDs of the types the instances use (EFIX), indexed by Instance::fixup_type.

§fixup_type_signatures: Vec<u32>

The signatures that go with fixup_type_guids; there may be fewer than GUIDs.

§boxed_reference_offsets: Vec<u32>

The offsets of boxed-value references (EFIX), if the chunk carries them.

§types: Vec<TypeDescriptor>

The reflected types.

§fields: Vec<FieldDescriptor>

The reflected fields; each type owns a run of them.

§instances: Vec<Instance>

The instances in EFIX order, the exported ones first.

§imports: Vec<ImportReference>

The documents this one imports from.

§arrays: Vec<ArrayRecord>

The EBXX array records.

§boxed_values: Vec<BoxedValueRecord>

The EBXX boxed-value records, sorted by offset.

§pointer_offsets: Vec<u32>

Payload offsets of the pointer fields (EFIX).

§resource_ref_offsets: Vec<u32>

Payload offsets of the resource-reference fields (EFIX).

§import_offsets: Vec<u32>

Payload offsets of the import pointers (EFIX).

§type_info_offsets: Vec<u32>

Payload offsets of the type-reference fields (EFIX).

§boxed_value_slots: Vec<u32>

Payload offsets of the boxed-value fields found while reading values.

§payload: Vec<u8>

The EBXD bytes as read (from data_start): what boxed values point at is carried from here.

§reflection_groups: Vec<ReflectionGroup>

The RFL2 array-type groups.

Implementations§

Source§

impl Document

Source

pub fn fixup_type_target(&self, slot: usize) -> Option<usize>

The reflected type (Document::types index) the EFIX type list’s slot names, by GUID and signature (the GUID alone when the list has no signature for the slot); None when the slot is past the list or the document reflects no such type (the list names GUIDs the reflection table lacks).

Source

pub fn type_ref_target(&self, t: &TypeRef) -> Option<usize>

The reflected type (Document::types index) a type reference names; None for an empty or primitive reference and for one whose EFIX slot reflects no type.

Source

pub fn enum_members( &self, field: usize, ) -> impl Iterator<Item = (&str, i64)> + '_

The members of the enumeration field (an index into Document::fields, FieldValue::descriptor) declares: each member’s name and value. The reflection table lists an enumeration as a type whose fields are its members, the value of a member being the field’s data_offset read as a signed 32-bit number. Empty for a field that is not an enumeration and for an enumeration with no members.

Source

pub fn enum_member(&self, field: usize, value: i64) -> Option<&str>

The name of the member of the enumeration field (Document::enum_members) that has value; None when the field is not an enumeration or no member has the value (one stock value, of 3,368,510, names no member).

Source

pub fn array_data_offset(&self, slot: u32) -> Option<u32>

Where the elements of the array whose 4-byte slot lies at payload offset slot start (payload offsets, as Instance::data_offset): the slot holds a displacement from itself to the first element, the count lying just before it. None when the slot or the target lies outside the payload.

Source

pub fn type_name(&self, i: usize) -> Option<&str>

The type name of instance i.

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Document

Source§

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

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

impl PartialEq for Document

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Document

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.