Skip to main content

Crate windows_metadata

Crate windows_metadata 

Source
Expand description

§windows-metadata

The windows-metadata crate reads and writes the ECMA-335 metadata format used by .NET, WinRT, and Win32 metadata.

Start by adding the following to your Cargo.toml file:

[dependencies.windows-metadata]
version = "0.100"

Query a type with the metadata reader:

use windows_metadata::*;

let index = reader::Index::read("Windows.winmd").unwrap();

let def = index.expect("Windows.Foundation", "Point");
assert_eq!(def.namespace(), "Windows.Foundation");
assert_eq!(def.name(), "Point");

let extends = def.extends().unwrap();
assert_eq!(extends.namespace(), "System");
assert_eq!(extends.name(), "ValueType");

let fields: Vec<_> = def.fields().collect();
assert_eq!(fields.len(), 2);
assert_eq!(fields[0].name(), "X");
assert_eq!(fields[1].name(), "Y");
assert_eq!(fields[0].ty(), Type::F32);
assert_eq!(fields[1].ty(), Type::F32);

Re-exports§

pub use reader::AsRow;
pub use reader::HasAttributes;

Modules§

merge
Metadata merge and namespace remapping support.
reader
writer

Structs§

AssemblyFlags
FieldAttributes
GenericParamAttributes
MethodAttributes
MethodCallAttributes
MethodImplAttributes
PInvokeAttributes
ParamAttributes
Signature
TypeAttributes
TypeName

Enums§

Type
Value

Functions§

merge
Creates a builder for combining winmd files.
remap
Creates a merge::Remapper that rewrites a flat winmd into a header-based namespace partition for --package generation.
trim_tick
Removes the generic arity suffix beginning with a backtick.