Skip to main content

Tpm2bCreationDataWire

Struct Tpm2bCreationDataWire 

Source
pub struct Tpm2bCreationDataWire(/* private fields */);

Implementations§

Source§

impl Tpm2bCreationDataWire

Source

pub fn cast(buf: &[u8]) -> TpmResult<&Self>
where TpmsCreationData: for<'a> TpmField<'a>,

Casts bytes into a typed TPM2B wire view.

§Errors

Returns Err(TpmError) when buf is not exactly one valid TPM2B wrapper for the inner type.

Source

pub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>
where TpmsCreationData: for<'a> TpmField<'a>,

Casts the first TPM2B wire view from buf and returns the remainder.

§Errors

Returns Err(TpmError) when buf does not start with a valid TPM2B wrapper for the inner type.

Source

pub unsafe fn cast_unchecked(buf: &[u8]) -> &Self

Casts bytes into a typed TPM2B wire view without validation.

§Safety

The caller must ensure buf is exactly one valid TPM2B wrapper for the inner type.

Source

pub const fn as_bytes(&self) -> &[u8]

Returns the complete TPM2B wrapper bytes.

Source

pub fn inner(&self) -> TpmResult<<TpmsCreationData as TpmField<'_>>::View>
where TpmsCreationData: for<'a> TpmField<'a>,

Returns the borrowed inner structure view.

§Errors

Returns Err(TpmError) when the TPM2B payload is not exactly one valid inner structure.

Source

pub fn validate(buf: &[u8]) -> TpmResult<()>
where TpmsCreationData: for<'a> TpmField<'a>,

Validates an exact typed TPM2B wire view.

§Errors

Returns Err(TpmError) when buf is not exactly one valid TPM2B wrapper for the inner type.

Source

pub fn validate_prefix(buf: &[u8]) -> TpmResult<usize>
where TpmsCreationData: for<'a> TpmField<'a>,

Validates a typed TPM2B wire view prefix.

§Errors

Returns Err(TpmError) when buf does not start with a valid TPM2B wrapper for the inner type.

Trait Implementations§

Source§

impl AsRef<[u8]> for Tpm2bCreationDataWire

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more