pub trait TpmCast {
// Required methods
fn cast(buf: &[u8]) -> TpmResult<&Self>;
unsafe fn cast_unchecked(buf: &[u8]) -> &Self;
// Provided method
fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])> { ... }
}Expand description
Casts caller-owned bytes into a TPM wire view.
Required Methods§
Sourcefn cast(buf: &[u8]) -> TpmResult<&Self>
fn cast(buf: &[u8]) -> TpmResult<&Self>
Casts buf into Self after validating the wire-view invariants.
§Errors
Returns Err(TpmError) when buf does not satisfy the
invariants for Self.
Sourceunsafe fn cast_unchecked(buf: &[u8]) -> &Self
unsafe fn cast_unchecked(buf: &[u8]) -> &Self
Casts buf into Self without validating the wire-view invariants.
§Safety
The caller must ensure that buf satisfies the same invariants checked
by TpmCast::cast.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".