Expand description
§msvc_def
A no_std (with optional alloc and std features) compatible library for reading
Microsoft Module-Definition (.Def) Files.
const CONTENTS: &str = "
LIBRARY \"mylib\"
EXPORTS
myfunc = inner_func @1
";
// Available both as no_std, no_alloc references only
let file = msvc_def::parse_ref(CONTENTS)?;
assert_eq!(file.is_library, Some(true));
assert_eq!(file.name, Some("mylib"));
// With iterator based variable length items
let mut export = file.exports;
assert_eq!(export.next(), Some(Ok(ExportRef::new("myfunc", Some("inner_func"), Some(1), false, false, false))));
assert_eq!(export.next(), None);
// And as no_std, alloc owned types
let file = msvc_def::parse(CONTENTS)?;
assert_eq!(file.is_library, Some(true));
assert_eq!(file.name, Some("mylib".to_string()));
// With Vec based variable length items
let mut export = file.exports;
assert_eq!(export.len(), 1);
assert_eq!(export.get(0), Some(Export::new("myfunc".to_string(), Some("inner_func".to_string()), Some(1), false, false, false)).as_ref());
assert_eq!(export.get(1), None);§Usage
Add the following to Cargo.toml:
[dependencies]
msvc_def = "0.1.0"§Features
alloc: AddsModuleDefinitionFile.std: AddsErrorsupport forParseError. Enablesallocfeature.
§Notes
Documentation items in code highlighting are taken directly from the Microsoft Reference.
Structs§
- Export
alloc - Exported function.
- Export
Ref [A] section of one or more export definitions that specify the exported names or ordinals of functions or data.- Exports
- Iterator over
ExportRefs. - Module
Definition File alloc - Owned version of
ModuleDefinitionFileRef. - Module
Definition File Ref - File representaion that doesn’t use
alloc, but uses iterators instead. - Parse
Error - The possible errors during parsing along with an index into the string for where the problem began.
- Section
alloc - Section in image.
- Section
Ref - Reference based section in the image.
- Sections
- Iterator over
SectionRefs.
Enums§
- Parse
Error Kind - Kind of error.