-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot put .capnp file in a submodule #16
Comments
Yep, the generated code assumes that you add it as a module at the top level of the crate. A shortcut to get the local file's scope wouldn't solve the general case, where we might have multiple schemas that refer to each other. To support non-top-level generated modules, I think we need to add an annotation to tell PS. Whoa, I didn't know about the |
Also running into this issue, currently hotfixing it by replacing all |
This is mainly a code generation issue, so I'm closing in favor of this issue in capnpc-rust: capnproto/capnpc-rust#5 |
Reopening here, as capnpc-rust has been moved back into this repo. |
As mentioned in #107, a possible but breaking change that would solve this issue might look like this broken link. Discussion on this is a little bit scattered so I'll quote @dwrensha's links to related issues again: I don't use the
@dwrensha So, the idea is to specify a namespace on top of each schema file to invoke non-default behavior? Other than that I don't see anyone mentioning an approach to solve this issue. More discussion on this that gets us somewhere would be appreciated! Update: I'm not interested in this anymore. |
I am having a problem with this now. In trying to see what the solution is, my search led me to capnproto/capnpc-rust#5 first, than this one, and from here capnproto/capnpc-rust#30. It seems that #5 was closed because #16 was open, and #16 was closed because of #5. Glad it has been re-opened as of August 30, 2018. I can get mine to complie if I change the generated code with instances of, for example, ::foo_capnp::first_msg::second_msg to self::second_msg. This is using edition = "2018" in the toml file. I hope we can find a fix for this situation of using capnp List. Thanks. |
I'm also doing the replace hack |
Fixed in 57ab346. |
To use the new feature, you need to import To indicate that you will include the generated code under the module |
Thank-you! |
(oops, accidentally submitted early)
Here's an example:
test.rs:
test.capnp:
This errors with:
The problem is that
test_capnp.rs
is using::
to try to get to the top of the file, but instead that is referring to the top of the crate. Unfortunately I don't think there's any shorthand to get to the top of the local file scope, so to do this, we would need to create a series ofsuper::...
s to walk up the current module chain to get to the root.The text was updated successfully, but these errors were encountered: