pub trait PlatformDeserializableTrusted {
// Required methods
fn deserialize_from_bytes_trusted_with_bytes_len(
data: &[u8],
) -> Result<(Self, usize), ProtocolError>
where Self: Sized;
fn deserialize_from_bytes_trusted_no_limit_with_bytes_len(
data: &[u8],
) -> Result<(Self, usize), ProtocolError>
where Self: Sized;
// Provided methods
fn deserialize_from_bytes_trusted(
data: &[u8],
) -> Result<Self, ProtocolError>
where Self: Sized { ... }
fn deserialize_from_bytes_trusted_no_limit(
data: &[u8],
) -> Result<Self, ProtocolError>
where Self: Sized { ... }
fn deserialize_from_bytes_trusted_exact(
data: &[u8],
) -> Result<Self, ProtocolError>
where Self: Sized { ... }
}Expand description
Deserialization of bytes this node wrote itself: Drive state read back from GroveDB, wallet storage, locally generated fixtures.
Runs bincode’s ordinary decoder, which reserves each collection from its
length prefix, so it must never see bytes that arrived from a peer, a
client, a proof or a host caller; those go through
PlatformDeserializableUntrusted.
The derive implements the two _with_bytes_len methods, which report how
many bytes the value took; the other methods are defaults over them.
Required Methods§
Sourcefn deserialize_from_bytes_trusted_with_bytes_len(
data: &[u8],
) -> Result<(Self, usize), ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_trusted_with_bytes_len(
data: &[u8],
) -> Result<(Self, usize), ProtocolError>where
Self: Sized,
Decodes under the type’s configured byte budget, returning the value and the number of bytes it took.
Sourcefn deserialize_from_bytes_trusted_no_limit_with_bytes_len(
data: &[u8],
) -> Result<(Self, usize), ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_trusted_no_limit_with_bytes_len(
data: &[u8],
) -> Result<(Self, usize), ProtocolError>where
Self: Sized,
Self::deserialize_from_bytes_trusted_with_bytes_len without the
byte budget.
Provided Methods§
Sourcefn deserialize_from_bytes_trusted(data: &[u8]) -> Result<Self, ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_trusted(data: &[u8]) -> Result<Self, ProtocolError>where
Self: Sized,
Decodes under the type’s configured byte budget. Bytes left over after
the value are ignored; Self::deserialize_from_bytes_trusted_exact
refuses them.
fn deserialize_from_bytes_trusted_no_limit(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
Sourcefn deserialize_from_bytes_trusted_exact(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
fn deserialize_from_bytes_trusted_exact(
data: &[u8],
) -> Result<Self, ProtocolError>where
Self: Sized,
Self::deserialize_from_bytes_trusted that also refuses bytes left
over after the value.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".