Crates.io | alloy-rlp |
lib.rs | alloy-rlp |
version | |
source | src |
created_at | 2023-06-13 02:30:14.29668 |
updated_at | 2024-10-23 15:32:02.63514 |
description | Implementation of Ethereum RLP serialization |
homepage | https://github.com/alloy-rs/rlp/tree/main/crates/rlp |
repository | https://github.com/alloy-rs/rlp |
max_upload_size | |
id | 888615 |
Cargo.toml error: | TOML parse error at line 23, column 1 | 23 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This crate provides Ethereum RLP (de)serialization functionality. RLP is commonly used for Ethereum EL datastructures, and its documentation can be found at ethereum.org.
We strongly recommend deriving RLP traits via the RlpEncodable
and
RlpDecodable
derive macros.
Trait methods can then be accessed via the Encodable
and Decodable
traits.
# #[cfg(feature = "derive")] {
use alloy_rlp::{RlpEncodable, RlpDecodable, Decodable, Encodable};
#[derive(Debug, RlpEncodable, RlpDecodable, PartialEq)]
pub struct MyStruct {
pub a: u64,
pub b: Vec<u8>,
}
let my_struct = MyStruct {
a: 42,
b: vec![1, 2, 3],
};
let mut buffer = Vec::<u8>::new();
let encoded = my_struct.encode(&mut buffer);
let decoded = MyStruct::decode(&mut buffer.as_slice()).unwrap();
assert_eq!(my_struct, decoded);
# }