I finally got it working. The main problem was that I didn't understand 
that the build file automated the capnpc process and that I needed to 
understand that capnp disables the use of the std lib. There are still some 
problems. 

The build seems to have worked when I use the absolute path, while the 
examples can use just the filename or schema/filename. For me it searches 
in the root dir when doing that, any idea why that could be? 
This is my build.rs: 
fn main() {
    capnpc::CompilerCommand::new()
        .src_prefix("src/schema")
        .file("src/schema/user.capnp")
        .run()
        .expect("schema compiler command");
}


The other problem I'm facing is that I can't see the actual files the 
compiler created. Where should I expect those files? This is my lib.rs:
mod user_schema {
    include!(concat!(env!("OUT_DIR"), "/user_capnp.rs"));
}
Where can I specify the value of OUT_DIR and what would you recommend as a 
location for this?
Op vrijdag 1 september 2023 om 07:51:01 UTC+2 schreef Troy Farrell:

> It may help to read some of the examples for capnproto-rust:
>
> https://github.com/capnproto/capnproto-rust/tree/master/example
>
> Using "cargo build" with a build.rs file is the normal way to compile 
> your .capnp files for Rust.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/6d9bd36c-3b6e-40bf-9476-605b1f05d136n%40googlegroups.com.

Reply via email to