Skip to main content

Header

Struct Header 

Source
#[repr(C)]
pub struct Header {
Show 78 fields pub magic: [u8; 4], pub version: u32, pub crate_name_offset: u32, pub crate_version_offset: u32, pub string_pool_offset: u64, pub string_pool_len: u64, pub files_offset: u64, pub files_count: u32, pub unit_key_offset: u32, pub defs_offset: u64, pub defs_count: u32, pub generation_offset: u32, pub defs_by_hash_offset: u64, pub defs_by_hash_count: u32, pub _pad2: u32, pub refs_offset: u64, pub refs_count: u32, pub _pad3: u32, pub refs_by_target_offset: u64, pub refs_by_target_count: u32, pub _pad4: u32, pub types_offset: u64, pub types_count: u32, pub _pad5: u32, pub defs_by_owner_offset: u64, pub defs_by_owner_count: u32, pub _pad6: u32, pub derefs_offset: u64, pub derefs_count: u32, pub _pad7: u32, pub notes_offset: u64, pub notes_count: u32, pub _pad8: u32, pub ty_defs_offset: u64, pub ty_defs_count: u32, pub _pad9: u32, pub ty_entries_offset: u64, pub ty_entries_count: u32, pub _pad10: u32, pub ty_bounds_offset: u64, pub ty_bounds_count: u32, pub _pad11: u32, pub ty_args_offset: u64, pub ty_args_count: u32, pub _pad12: u32, pub fn_sigs_offset: u64, pub fn_sigs_count: u32, pub _pad13: u32, pub impls_offset: u64, pub impls_count: u32, pub _pad14: u32, pub assoc_tys_offset: u64, pub assoc_tys_count: u32, pub _pad15: u32, pub fields_offset: u64, pub fields_count: u32, pub _pad16: u32, pub def_tys_offset: u64, pub def_tys_count: u32, pub _pad17: u32, pub generic_params_offset: u64, pub generic_params_count: u32, pub _pad18: u32, pub where_preds_offset: u64, pub where_preds_count: u32, pub _pad19: u32, pub lang_items_offset: u64, pub lang_items_count: u32, pub _pad20: u32, pub uses_offset: u64, pub uses_count: u32, pub _pad21: u32, pub cfgs_offset: u64, pub cfgs_count: u32, pub target_offset: u32, pub macro_defs_offset: u64, pub macro_defs_count: u32, pub _pad22: u32,
}
Expand description

Fixed-size header at offset 0 of any .ridx file (format version 5, 416 bytes; v4 is 176, v3 is 160).

Fields§

§magic: [u8; 4]

Magic signature (“RIDX”)

§version: u32

Format version (currently 5)

§crate_name_offset: u32

Offset in string pool for crate name

§crate_version_offset: u32

Offset in string pool for crate version

§string_pool_offset: u64

Offset of the string intern pool

§string_pool_len: u64

Length in bytes of the string intern pool

§files_offset: u64

Offset of the file path table (array of FileEntry)

§files_count: u32§unit_key_offset: u32

Offset in string pool for compilation unit key (or 0)

§defs_offset: u64

Offset of the definitions table (array of DefEntry)

§defs_count: u32§generation_offset: u32

Offset in string pool for source snapshot generation (or 0)

§defs_by_hash_offset: u64

Offset of the definitions hash index (array of HashIndexEntry sorted by hash)

§defs_by_hash_count: u32§_pad2: u32§refs_offset: u64

Offset of the references table (array of RefEntry sorted by span)

§refs_count: u32§_pad3: u32§refs_by_target_offset: u64

Offset of the references-by-target hash index (array of HashIndexEntry sorted by target hash)

§refs_by_target_count: u32§_pad4: u32§types_offset: u64

Offset of the types table (array of TypeEntry sorted by span)

§types_count: u32§_pad5: u32§defs_by_owner_offset: u64

Offset of the definitions-by-owner table (array of OwnerIndexEntry sorted by hash)

§defs_by_owner_count: u32§_pad6: u32§derefs_offset: u64

Offset of the deref mapping table (array of DerefEntry sorted by source_type_hash)

§derefs_count: u32§_pad7: u32§notes_offset: u64

Offset of the notes table (array of NoteEntry sorted by span); version 4.

§notes_count: u32§_pad8: u32§ty_defs_offset: u64

Offset of the TyArena definition table (TyDefEntry); version 5.

§ty_defs_count: u32§_pad9: u32§ty_entries_offset: u64

Offset of the TyArena interned type table (TyEntry); version 5.

§ty_entries_count: u32§_pad10: u32§ty_bounds_offset: u64

Offset of the TyArena trait bound table (TyBoundEntry); version 5.

§ty_bounds_count: u32§_pad11: u32§ty_args_offset: u64

Offset of the TyArena packed generic argument pool (u32); version 5.

§ty_args_count: u32§_pad12: u32§fn_sigs_offset: u64

Offset of the structured FnSigEntry table (sorted by def_index); version 5.

§fn_sigs_count: u32§_pad13: u32§impls_offset: u64

Offset of the structured ImplEntry table (sorted by simplified_self); version 5.

§impls_count: u32§_pad14: u32§assoc_tys_offset: u64

Offset of the AssocTyEntry table (contiguous per ImplEntry); version 5.

§assoc_tys_count: u32§_pad15: u32§fields_offset: u64

Offset of the FieldEntry table (sorted by (owner_def_index, field_idx)); version 5.

§fields_count: u32§_pad16: u32§def_tys_offset: u64

Offset of the DefTyEntry table (sorted by def_index); version 5.

§def_tys_count: u32§_pad17: u32§generic_params_offset: u64

Offset of the GenericParamEntry table (sorted by (owner_key, param_idx)); version 5.

§generic_params_count: u32§_pad18: u32§where_preds_offset: u64

Offset of the WherePredEntry table (sorted by owner_key); version 5.

§where_preds_count: u32§_pad19: u32§lang_items_offset: u64

Offset of the LangItemEntry table (sorted by kind); version 5.

§lang_items_count: u32§_pad20: u32§uses_offset: u64

Offset of the UseEntry table (sorted by (owner_raw, name_str)); version 5.

§uses_count: u32§_pad21: u32§cfgs_offset: u64

Offset of the CfgEntry table (sorted by (key_str, Option<val_str>)); version 5.

§cfgs_count: u32§target_offset: u32

Offset in string pool for effective target triple (or 0); version 5.

§macro_defs_offset: u64

Offset of the MacroDefEntry table (sorted by def_index); version 5.

§macro_defs_count: u32§_pad22: u32

Implementations§

Source§

impl Header

Source

pub fn to_le(self) -> Self

Source

pub fn from_le(self) -> Self

Source

pub fn target_offset(&self) -> u32

Source

pub fn unit_key_offset(&self) -> u32

Source

pub fn generation_offset(&self) -> u32

Source§

impl Header

Source

pub fn from_le_v4(bytes: &[u8]) -> Self

Decodes a version 4 header (176 bytes), zeroing the v5 TyArena section descriptors.

Source

pub fn from_le_v3(bytes: &[u8]) -> Self

Decodes a version 3 header (160 bytes), zeroing notes and TyArena section descriptors.

Source

pub fn from_le_v2(bytes: &[u8]) -> Self

Decodes a version 2 header (128 bytes), setting v3/v4/v5-specific table offsets and counts to 0.

Trait Implementations§

Source§

impl Clone for Header

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 Copy for Header

Source§

impl Debug for Header

Source§

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

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

impl Default for Header

Source§

fn default() -> Self

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

impl Eq for Header

Source§

impl PartialEq for Header

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 Header

Auto Trait Implementations§

§

impl Forget for Header

§

impl Freeze for Header

§

impl Move for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnsafeUnpin for Header

§

impl UnwindSafe for Header

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 = !

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.