Skip to main content

TpmCastMut

Trait TpmCastMut 

Source
pub trait TpmCastMut: TpmCast {
    // Required methods
    fn cast_mut(buf: &mut [u8]) -> TpmResult<&mut Self>;
    unsafe fn cast_mut_unchecked(buf: &mut [u8]) -> &mut Self;

    // Provided method
    fn cast_prefix_mut(buf: &mut [u8]) -> TpmResult<(&mut Self, &mut [u8])> { ... }
}
Expand description

Casts caller-owned mutable bytes into a mutable TPM wire view.

Required Methods§

Source

fn cast_mut(buf: &mut [u8]) -> TpmResult<&mut Self>

Casts buf into mutable Self after validating the wire-view invariants.

§Errors

Returns Err(TpmError) when buf does not satisfy the invariants for Self.

Source

unsafe fn cast_mut_unchecked(buf: &mut [u8]) -> &mut Self

Casts buf into mutable Self without validating the wire-view invariants.

§Safety

The caller must ensure that buf satisfies the same invariants checked by TpmCastMut::cast_mut. The returned reference inherits the exclusive access represented by buf.

Provided Methods§

Source

fn cast_prefix_mut(buf: &mut [u8]) -> TpmResult<(&mut Self, &mut [u8])>

Casts the first mutable wire value in buf into Self and returns the remainder.

§Errors

Returns Err(TpmError) when buf does not start with a valid Self.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl TpmCastMut for TpmCommand

Source§

impl TpmCastMut for TpmResponse

Source§

impl TpmCastMut for TpmWire

Source§

impl<T, const N: usize> TpmCastMut for TpmInt<T, N>

Source§

impl<const CAPACITY: usize> TpmCastMut for Tpm2b<CAPACITY>

Source§

impl<const CAPACITY: usize> TpmCastMut for Tpml<CAPACITY>

Source§

impl<const N: usize> TpmCastMut for TpmWireBytes<N>