Skip to main content

Index

Struct Index 

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

Indexes metadata as raw types and as Win32 Apis-expanded items.

Implementations§

Source§

impl Index

Source

pub fn read<P: AsRef<Path>>(path: P) -> Option<Self>

Reads a single metadata file from disk and builds an Index for it.

Source

pub fn new(files: Vec<File>) -> Self

Builds an Index over the given metadata files.

Source

pub fn new_for_architecture(files: Vec<File>, architecture: i32) -> Self

Builds an Index filtered to one architecture bit (1=X86, 2=X64, 4=Arm64). A zero bit preserves all architecture-specific rows.

Source

pub fn leak(self) -> &'static Self

Leaks self for consumers that need 'static metadata rows.

Source

pub fn read_static<P: AsRef<Path>>(path: P) -> Option<&'static Self>

Reads one metadata file and leaks the resulting Index.

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &str, TypeDef<'_>)> + '_

Iterates (namespace, name, TypeDef) triples over every type in the index.

Source

pub fn types(&self) -> impl Iterator<Item = TypeDef<'_>> + '_

Iterates every TypeDef in the index.

Source

pub fn get( &self, namespace: &str, name: &str, ) -> impl Iterator<Item = TypeDef<'_>> + '_

Iterates the TypeDefs matching (namespace, name).

Source

pub fn contains_namespace(&self, namespace: &str) -> bool

Returns whether any type lives in namespace.

Source

pub fn contains(&self, namespace: &str, name: &str) -> bool

Returns whether the (namespace, name) type exists.

Source

pub fn assembly_name(&self, namespace: &str, name: &str) -> Option<&str>

Returns the assembly name of the first file in which (namespace, name) was defined.

Source

pub fn expect(&self, namespace: &str, name: &str) -> TypeDef<'_>

Returns the single TypeDef matching (namespace, name), panicking if there are zero or more than one.

Source

pub fn nested(&self, ty: TypeDef<'_>) -> impl Iterator<Item = TypeDef<'_>> + '_

Iterates the types directly nested inside ty. Use Self::nested_recursive to recurse.

Source

pub fn nested_recursive<'a>(&'a self, ty: TypeDef<'a>) -> Vec<TypeDef<'a>>

Depth-first walk of every type nested directly or transitively inside ty.

Source

pub fn namespaces(&self) -> impl Iterator<Item = &str> + '_

Iterates every namespace that contains at least one item.

Source

pub fn iter_items(&self) -> impl Iterator<Item = (&str, &str, Item<'_>)> + '_

Iterates (namespace, name, Item) triples over every item in the index.

Source

pub fn items(&self) -> impl Iterator<Item = Item<'_>> + '_

Iterates every Item in the index.

Source

pub fn namespace_items( &self, namespace: &str, ) -> impl Iterator<Item = (&str, Item<'_>)> + '_

Iterates (name, Item) pairs in namespace.

Source

pub fn get_item( &self, namespace: &str, name: &str, ) -> impl Iterator<Item = Item<'_>> + '_

Iterates the Items matching (namespace, name).

Source

pub fn expect_item(&self, namespace: &str, name: &str) -> Item<'_>

Returns the single Item matching (namespace, name), panicking if there are zero or more than one.

Auto Trait Implementations§

§

impl Freeze for Index

§

impl RefUnwindSafe for Index

§

impl Send for Index

§

impl Sync for Index

§

impl Unpin for Index

§

impl UnsafeUnpin for Index

§

impl UnwindSafe for Index

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

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.