XDRS (XDR Serialization)
This package provides:
-
Traits
ReadXDRandWriteXDR, for converting between Rust values and the XDR data model -
Derive-macros
ReadXDR,WriteXDR,XDR, andConstWriteXDR(see cratexdr_derive) -
Traits
serialize::Readerandserialize::Writer, for converting between the XDR data model and some serialization format -
Implementations of
serialize::{Reader, Writer}:- CXS (see module
cxs) - TXS ("Traditional XDR Serialization") (see module
txs)
- CXS (see module
The library is no_std. Optional features:
detailed-errors(enabled by default): retain preciseReadErrorvariants and diagnostic payloads. Contract builds can usedefault-features = falseto replace them with a single compact error value while preserving identical validation behavioralloc: allocation-based interfaces (Vec,String, growableBufWriters, ownedencode()functions)permissive: accept non-minimal CXS integer encodings and non-zero TXS padding when decodingint128:i128/u128supportderive: derive macrosReadXDR,WriteXDR,XDR, andConstWriteXDR(cratexdr_derive)repr: datatypes representing XDR specifications (cratexdr_repr; impliesalloc)ns: C++-like namespaces for XDR specs inxdr_repr(impliesrepr)heapless: serialization support forheaplesstypes, plus schema support when combined withreprserde/schemars: serde and JSON-schema support forxdr_commontypes
See the crate docs (cargo doc --open) for details on each feature and
the full API.
ONC-RPC (rpc/)
The ONC-RPC stack built on xdrs — rpc_api (the stable API boundary for
generated bindings) and rpc_driver (transports, pools, server) — lives in
rpc/. It was previously the thruputchain/xdr_rpc
repository. rpc_driver shares the workspace version with the xdrs
crates and releases under the same v<version> tag; rpc_api versions
independently under rpc_api-v<version>.
On crates.io every crate here is published with a thruput- prefix:
thruput-xdrs, thruput-xdr-common, thruput-xdr-derive, thruput-xdr-repr,
thruput-rpc-api and thruput-rpc-driver. Their library names don't change,
so code still uses xdrs::, rpc_api:: and so on.
TODOs
- Consider adding an optional recursion depth limit for decoding
potentially-recursive datastructures (see
read_xdrmodule docs for current guidance on bounding stack usage externally)
Coverage
Install the report tool and LLVM tools for the pinned coverage nightly:
The coverage workflow runs the same script and uploads coverage artifacts
containing HTML (target/llvm-cov/html/index.html) and LCOV.
It merges the allocating workspace, no-alloc, compact-error, and permissive
integer tests. This is a baseline report, without a minimum percentage gate;
doctests and benchmarks are not included. Generated code remains instrumented.
The macro generator's own coverage and execution of its generated methods are
separate: generated methods are attributed to their invocation sites, including
those in integration tests.
Generated code coverage
Derive-generated methods are always instrumented, like any other code. The
derives emit no coverage attributes, so consuming crates need no nightly feature
gate and no cfg registration, and they see no unexpected_cfgs diagnostics.
Earlier versions emitted #[cfg_attr(coverage_nightly, coverage(off))] to keep
generated methods out of reports, behind an opt-out include-generated-coverage
feature. That feature is gone. Because coverage(off) is still unstable, the
attribute had to be gated on a cfg that only cargo-llvm-cov sets — which every
downstream crate then had to register to build warning-free. Excluding generated
code from a report is not worth imposing that on consumers.