#module #syn #rust

myd

An implementation of the rust module system

2 releases

0.1.1 Apr 4, 2023
0.1.0 Apr 2, 2023

#1027 in Filesystem

25 downloads per month

MIT/Apache

74KB
1.5K SLoC

Myd

Pronounced /mi:d/, like mead

Myd is a rust library to create a representation of the rust module tree as a usable datatype, and to resolve imports. It is designed to be used by tools working with rust source code to be less naïve about the module system.

Examples

Parse a package:

// Expensive operation: may take a few seconds
let mi = myd::parse::parse("./Cargo.toml");

Work out where something is imported from:

let my_path: syn::Path = syn::parse_str("std::collections::HashMap");
let hashmap = mi.path(my_node, my_path)

See the examples for more.

Dependencies

~1.4–2.4MB
~48K SLoC