msvc_def 0.1.0

Library for reading Microsoft Module Definition (.def) files.
Documentation
  • Coverage
  • 100%
    66 out of 66 items documented1 out of 3 items with examples
  • Size
  • Source code size: 91.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 7.51 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • gtker

msvc_def

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"

Or add with cargo:

cargo add msvc_def

Features

  • alloc: Adds [ModuleDefinitionFile].
  • std: Adds Error support for [ParseError]. Enables alloc feature.

Notes

Documentation items in code highlighting are taken directly from the Microsoft Reference.