Closed
Description
It looks like the code generated by the buf.build/community/neoeinstein-prost-serde:v0.3.0
is not usable in no_std
context:
$ git clone [email protected]:cosmos/cosmos-rust
$ cd cosmos-rust/cosmos-sdk-proto
$ git checkout cosmos-sdk-proto/v0.25.0-pre.0
$ cargo check --no-default-features --features serde
(...)
error[E0433]: failed to resolve: use of undeclared crate or module `std`
--> cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.auth.v1beta1.serde.rs:5:46
|
5 | fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
| ^^^ use of undeclared crate or module `std`
(...)
error[E0433]: failed to resolve: use of undeclared type `ToString`
--> cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.v1beta1.serde.rs:1191:50
|
1191 | struct_ser.serialize_field("length", ToString::to_string(&self.length).as_str())?;
| ^^^^^^^^ use of undeclared type `ToString`
|
help: consider importing one of these items
--> cosmos-sdk-proto/src/lib.rs:221:13
|
221 + use alloc::string::ToString;
--> |cosmos-sdk-proto/src/lib.rs:221:13
|
221 + use serde::__private::ToString;
(...)
To fix this, we should attempt to make the generated code work with no_std
, either by patching the output, or by using informal-pbjson
to generate the serialization code, like we do in ibc-proto-rs
.
Just enabling the std
feature when serde
is enabled is unfortunately not really an option, as ibc-proto
has downstream users which depend on the serde
feature but not std
.
As such it is currently blocking cosmos/ibc-proto-rs#187
Metadata
Metadata
Assignees
Labels
No labels