-
Notifications
You must be signed in to change notification settings - Fork 225
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
no alloc support #221
Comments
Yes, that is accurate: the
Note, however, that getting the |
Thanks for the response. For Capnproto to be viable, I don't require RPC support in no std; I only require the capability to statically decode a message of known maximum size. |
Tried it on STM32F051 (thumbv6m) with alloc-cortex-m crate. Unfortunately something in Btw size of the binary increased by approx 10kB after adding allocator and capnp dependencies (with opt-level = "z", codegen-units = 1, lto = true) Upd:
|
We got another report of a hard fault using the alloc-cortex-m crate here: #293 |
@romixlab I expect there's a good chance that if you upgrade to capnp-v0.14.10 the HardFault will go away (and probably be replaced by an allocation failure). |
Would be interesting to check again! |
@dwrensha I'm trying to integrate capnproto into the linux kernel, where there is an alloc crate but with limited functionality (e.g. all the allocations are fallible, so try_new is used instead of new; there is also no |
Yes, I still want this to happen, and I would review a PR. A question that I had been stuck on is: if capnproto-rust/capnp-rpc/src/rpc.rs Lines 368 to 384 in 3bbb520
The Just now I had the thought: |
Something like this? Errors are an enum and when the alloc feature is enabled, then they also include the string in the description.
|
Hm... that would work, but I'm worried that it would end up with a lot of pub enum Error {
IncompatibileTypes,
OutOfBounds,
// ...
#[cfg(feature="alloc")]
RpcError(String),
} The |
Yes, but what I'm trying to do is to avoid allocating a |
This is fixed in #417. We are aiming to release v0.18 with this change in the next week or so. |
no-alloc support was released just now in version 0.18.0 |
I note #71 Which adds support for
no_std
crates, butcapnp
still depends on an allocator.It is desirable to have support for environments that do not have an allocator / are memory constrained such as microcontrollers.
In my application, I am presently using
postcard
to provide object de/encoding on both sides of the wire. Among other features, it supports de/encoding messages out of a&[u8]
buffer, thus allowing it to work without alloc.I am evaluating capnproto to see if it can be a viable replacement for
postcard
and gRPC (replacing the latter with capnproto's RPC) as to simplify my software situation.It appears that
capnp
, even inno_std
mode, does not have a mechanism for statically parsing messages.The text was updated successfully, but these errors were encountered: