From 6bd9a25980b53ed803ffe7027280b1ab7c6a6069 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Thu, 16 Mar 2023 17:07:55 +0100 Subject: [PATCH] docs: add some encode docs (#1797) --- crates/rlp/src/encode.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/rlp/src/encode.rs b/crates/rlp/src/encode.rs index 0350a76b0c..0c11b5f8c0 100644 --- a/crates/rlp/src/encode.rs +++ b/crates/rlp/src/encode.rs @@ -70,7 +70,12 @@ macro_rules! impl_max_encoded_len { #[auto_impl(&)] #[cfg_attr(feature = "alloc", auto_impl(Box, Arc))] pub trait Encodable { + /// Appends the rlp encoded object to the specified output buffer. fn encode(&self, out: &mut dyn BufMut); + + /// Returns the length of the encoded object. + /// + /// NOTE: This includes the length of the rlp [Header]. fn length(&self) -> usize { let mut out = BytesMut::new(); self.encode(&mut out);