Skip to main content

TpmCast

Trait TpmCast 

Source
pub trait TpmCast {
    // Required methods
    fn cast(buf: &[u8]) -> TpmResult<&Self>;
    unsafe fn cast_unchecked(buf: &[u8]) -> &Self;
}
Expand description

Casts caller-owned bytes into a TPM wire view.

Required Methods§

Source

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.

Source

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§