dris-build 0.1.0

dris 的 build.rs 侧代码生成器(扫描 #[component]/#[constructor] 并生成容器代码)
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 104.21 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.91 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 25s Average build duration of successful builds.
  • all releases: 26s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wuhaiji

dris-build

dris-builddris 的 build.rs 侧代码生成器:在编译期扫描组件与构造函数,生成 ContainerOUT_DIR/dris_gen.rs

用法

生成代码会引用 dris_rt::All/dris_rt::Type 等路径(直接依赖 dris-rt 即可):

[dependencies]
dris-rt = "0.1.0"

[build-dependencies]
dris-build = "0.1.0"

build.rs

fn main() {
    dris_build::generate().unwrap();
}

在你的 crate 里引入生成文件:

include!(concat!(env!("OUT_DIR"), "/dris_gen.rs"));

然后就可以:

let container = dris_gen::Container::build();

扫描范围

  • 扫描当前 crate 的 #[component]/#[constructor]
  • 会尝试递归扫描依赖(path 依赖与 registry 依赖),以支持跨 crate 的组件组合。