alloy_rlp

Trait Encodable

source
pub trait Encodable {
    // Required method
    fn encode(&self, out: &mut dyn BufMut);

    // Provided method
    fn length(&self) -> usize { ... }
}
Expand description

A type that can be encoded via RLP.

Required Methods§

source

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.

Provided Methods§

source

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes.

The default implementation computes this by encoding the type. When possible, we recommender implementers override this with a specialized implementation.

Implementations on Foreign Types§

source§

impl Encodable for IpAddr

Available on crate feature std only.
source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for bool

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for str

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for u8

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for u16

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for u32

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for u64

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for u128

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for usize

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for String

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for PhantomPinned

source§

fn length(&self) -> usize

source§

fn encode(&self, _out: &mut dyn BufMut)

source§

impl Encodable for Ipv4Addr

Available on crate feature std only.
source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for Ipv6Addr

Available on crate feature std only.
source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for Bytes

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for BytesMut

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl Encodable for [u8]

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: Encodable> Encodable for Vec<T>

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: ?Sized + ToOwned + Encodable> Encodable for Cow<'_, T>

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: ?Sized + Encodable> Encodable for &T

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: ?Sized + Encodable> Encodable for &mut T

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: ?Sized + Encodable> Encodable for Box<T>

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: ?Sized + Encodable> Encodable for Rc<T>

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: ?Sized + Encodable> Encodable for Arc<T>

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<T: ?Sized> Encodable for PhantomData<T>

source§

fn length(&self) -> usize

source§

fn encode(&self, _out: &mut dyn BufMut)

source§

impl<const N: usize> Encodable for ArrayVec<u8, N>

Available on crate feature arrayvec only.
source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

source§

impl<const N: usize> Encodable for [u8; N]

source§

fn length(&self) -> usize

source§

fn encode(&self, out: &mut dyn BufMut)

Implementors§