From 66b95bf0029e5e8fe449ac74d4967147359f7c01 Mon Sep 17 00:00:00 2001 From: Dominik Nakamura Date: Sun, 5 Nov 2023 12:48:34 +0900 Subject: [PATCH] doc: update project setup instructions Correct the code samples in the guide to use the new APIs for generating Rust code and including the files. --- book/src/guide/generating.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/src/guide/generating.md b/book/src/guide/generating.md index 56488bc..3a5894c 100644 --- a/book/src/guide/generating.md +++ b/book/src/guide/generating.md @@ -10,7 +10,7 @@ The main entry point is the `stef-build` crate, which you use as build script in ```rust fn main() { - stef_build::compile(&["src/sample.stef"], &["src/"]).unwrap(); + stef_build::Compiler::default().compile(&["src/sample.stef"]).unwrap(); } ``` @@ -24,7 +24,7 @@ Continuing on the previous example, the generated could could be included like t // in src/main.rs mod sample { - include!(concat!(env!("OUT_DIR"), "/sample.rs")); + stef::include!("sample"); } fn main() { @@ -51,7 +51,7 @@ Then we could use the generated struct as follows: use stef::Encode; mod sample { - include!(concat!(env!("OUT_DIR"), "/sample.rs")); + stef::include!("sample"); } fn main() {