pub struct RlpEncode;Expand description
RLP Encoding Struct
Implementations§
Source§impl RlpEncode
impl RlpEncode
Sourcepub const LIST_SHORT_START: u8 = 192u8
pub const LIST_SHORT_START: u8 = 192u8
Starting point for short u8
Sourcepub const LIST_LONG_START: u8 = 247u8
pub const LIST_LONG_START: u8 = 247u8
Starting point for long u8
Sourcepub fn encode_bytes(bytes: Self) -> Vec<u8> ⓘ
pub fn encode_bytes(bytes: Self) -> Vec<u8> ⓘ
RLP-encode a byte string. Returns the RLP encoded string in bytes.
Sourcepub fn encode_list(bytes: Vec<Self>) -> Vec<u8> ⓘ
pub fn encode_list(bytes: Vec<Self>) -> Vec<u8> ⓘ
RLP-encode a list of RLP-encoded byte strings. Returns the RLP encoded list of items in bytes.
Sourcepub fn encode_uint(item: Self) -> Vec<u8> ⓘ
pub fn encode_uint(item: Self) -> Vec<u8> ⓘ
RLP-encode a uint. Returns the RLP encoded uint in bytes.
pub fn encode_int() -> Vec<u8> ⓘ
pub fn encode_bool() -> Vec<u8> ⓘ
Trait Implementations§
Source§impl BorshDeserialize for RlpEncode
impl BorshDeserialize for RlpEncode
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
Source§fn is_u8() -> bool
fn is_u8() -> bool
Whether Self is u8.
NOTE:
Vec<u8> is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8> implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details.Source§impl BorshSerialize for RlpEncode
impl BorshSerialize for RlpEncode
fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>
Source§fn try_to_vec(&self) -> Result<Vec<u8>, Error>
fn try_to_vec(&self) -> Result<Vec<u8>, Error>
Serialize this instance into a vector of bytes.
Source§fn is_u8() -> bool
fn is_u8() -> bool
Whether Self is u8.
NOTE:
Vec<u8> is the most common use-case for serialization and deserialization, it’s
worth handling it as a special case to improve performance.
It’s a workaround for specific Vec<u8> implementation versus generic Vec<T>
implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details.Source§impl<'de> Deserialize<'de> for RlpEncode
impl<'de> Deserialize<'de> for RlpEncode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RlpEncode
impl RefUnwindSafe for RlpEncode
impl Send for RlpEncode
impl Sync for RlpEncode
impl Unpin for RlpEncode
impl UnwindSafe for RlpEncode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more