witnet / protobuf-convert Goto Github PK
View Code? Open in Web Editor NEWMacros for convenient serialization of Rust data structures into/from Protocol Buffers 3
License: Apache License 2.0
Macros for convenient serialization of Rust data structures into/from Protocol Buffers 3
License: Apache License 2.0
Some data structures may at some times have computed or cached fields that are supposed not to be sent over the wire nor otherwise affect serialization.
For this feature to be supported, I'd expect protobuf-convert
macro to allow specifying fields that will be ignored, i.e. they will not be matched to any field in the schema.
This is an example of what this could look like: (taken from witnet-rust)
/// Transaction data structure
#[derive(Debug, Default, Eq, PartialEq, Clone, Serialize, Deserialize, ProtobufConvert)]
#[protobuf_convert(pb = "witnet::TransactionBody")]
pub struct TransactionBody {
pub version: u32,
pub inputs: Vec<Input>,
pub outputs: Vec<Output>,
#[protobuf_convert(skip)]
hash: Cell<Option<Hash>>,
}
It's no secret that failure
actually deprecated because it have a fundamental flaws in the desigin.
In Exonum we replace failure
by the anyhow
crate, but now we need to write tricky code like this to use anyhow
with the protobuf-convert
derive.
https://github.com/exonum/exonum/blob/master/services/supervisor/src/proto_structures.rs#L15
In my opinion there are no any arguments against switching to anyhow
.
If you agree I will make the corresponding PR to switch codegen to the anyhow
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.