alloy_rlp/
lib.rs

1#![doc = include_str!("../README.md")]
2#![doc(
3    html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
4    html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
5)]
6#![cfg_attr(not(feature = "std"), no_std)]
7#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
8
9#[macro_use]
10#[allow(unused_imports)]
11extern crate alloc;
12
13mod decode;
14pub use decode::{decode_exact, Decodable, Rlp};
15
16mod error;
17pub use error::{Error, Result};
18
19mod encode;
20#[cfg(feature = "arrayvec")]
21pub use encode::encode_fixed_size;
22pub use encode::{
23    encode, encode_iter, encode_list, length_of_length, list_length, Encodable, MaxEncodedLen,
24    MaxEncodedLenAssoc,
25};
26
27mod header;
28pub use header::{Header, PayloadView};
29
30#[doc(no_inline)]
31pub use bytes::{self, Buf, BufMut, Bytes, BytesMut};
32
33#[cfg(feature = "derive")]
34#[doc(inline)]
35pub use alloy_rlp_derive::{
36    RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper, RlpMaxEncodedLen,
37};
38
39/// RLP prefix byte for 0-length string.
40pub const EMPTY_STRING_CODE: u8 = 0x80;
41
42/// RLP prefix byte for a 0-length array.
43pub const EMPTY_LIST_CODE: u8 = 0xC0;
44
45// Not public API.
46#[doc(hidden)]
47#[deprecated(since = "0.3.0", note = "use `Error` instead")]
48pub type DecodeError = Error;
49
50#[doc(hidden)]
51pub mod private {
52    pub use core::{
53        default::Default,
54        option::Option::{self, None, Some},
55        result::Result::{self, Err, Ok},
56    };
57}