pub struct Index { /* private fields */ }Expand description
Indexes metadata as raw types and as Win32 Apis-expanded items.
Implementations§
Source§impl Index
impl Index
Sourcepub fn read<P: AsRef<Path>>(path: P) -> Option<Self>
pub fn read<P: AsRef<Path>>(path: P) -> Option<Self>
Reads a single metadata file from disk and builds an Index for it.
Sourcepub fn new_for_architecture(files: Vec<File>, architecture: i32) -> Self
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.
Sourcepub fn read_static<P: AsRef<Path>>(path: P) -> Option<&'static Self>
pub fn read_static<P: AsRef<Path>>(path: P) -> Option<&'static Self>
Reads one metadata file and leaks the resulting Index.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&str, &str, TypeDef<'_>)> + '_
pub fn iter(&self) -> impl Iterator<Item = (&str, &str, TypeDef<'_>)> + '_
Iterates (namespace, name, TypeDef) triples over every type in the index.
Sourcepub fn types(&self) -> impl Iterator<Item = TypeDef<'_>> + '_
pub fn types(&self) -> impl Iterator<Item = TypeDef<'_>> + '_
Iterates every TypeDef in the index.
Sourcepub fn get(
&self,
namespace: &str,
name: &str,
) -> impl Iterator<Item = TypeDef<'_>> + '_
pub fn get( &self, namespace: &str, name: &str, ) -> impl Iterator<Item = TypeDef<'_>> + '_
Iterates the TypeDefs matching (namespace, name).
Sourcepub fn contains_namespace(&self, namespace: &str) -> bool
pub fn contains_namespace(&self, namespace: &str) -> bool
Returns whether any type lives in namespace.
Sourcepub fn contains(&self, namespace: &str, name: &str) -> bool
pub fn contains(&self, namespace: &str, name: &str) -> bool
Returns whether the (namespace, name) type exists.
Sourcepub fn assembly_name(&self, namespace: &str, name: &str) -> Option<&str>
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.
Sourcepub fn expect(&self, namespace: &str, name: &str) -> TypeDef<'_>
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.
Sourcepub fn nested(&self, ty: TypeDef<'_>) -> impl Iterator<Item = TypeDef<'_>> + '_
pub fn nested(&self, ty: TypeDef<'_>) -> impl Iterator<Item = TypeDef<'_>> + '_
Iterates the types directly nested inside ty. Use Self::nested_recursive to recurse.
Sourcepub fn nested_recursive<'a>(&'a self, ty: TypeDef<'a>) -> Vec<TypeDef<'a>>
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.
Sourcepub fn namespaces(&self) -> impl Iterator<Item = &str> + '_
pub fn namespaces(&self) -> impl Iterator<Item = &str> + '_
Iterates every namespace that contains at least one item.
Sourcepub fn iter_items(&self) -> impl Iterator<Item = (&str, &str, Item<'_>)> + '_
pub fn iter_items(&self) -> impl Iterator<Item = (&str, &str, Item<'_>)> + '_
Iterates (namespace, name, Item) triples over every item in the index.
Sourcepub fn namespace_items(
&self,
namespace: &str,
) -> impl Iterator<Item = (&str, Item<'_>)> + '_
pub fn namespace_items( &self, namespace: &str, ) -> impl Iterator<Item = (&str, Item<'_>)> + '_
Iterates (name, Item) pairs in namespace.
Sourcepub fn get_item(
&self,
namespace: &str,
name: &str,
) -> impl Iterator<Item = Item<'_>> + '_
pub fn get_item( &self, namespace: &str, name: &str, ) -> impl Iterator<Item = Item<'_>> + '_
Iterates the Items matching (namespace, name).
Sourcepub fn expect_item(&self, namespace: &str, name: &str) -> Item<'_>
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.