pub struct TpmResponse(/* private fields */);Expand description
A zero-copy TPM response wire view over caller-owned bytes.
Implementations§
Source§impl TpmResponse
impl TpmResponse
Sourcepub fn cast(buf: &[u8]) -> TpmResult<&Self>
pub fn cast(buf: &[u8]) -> TpmResult<&Self>
Casts a byte slice into a TPM response wire view.
§Errors
Returns Err(TpmError) when the response envelope is malformed.
Sourcepub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>
pub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>
Casts the first TPM response frame in a byte slice into a wire view.
§Errors
Returns Err(TpmError) when the response envelope is malformed or
incomplete.
Sourcepub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
pub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
Casts a byte slice into a TPM response wire view without validation.
§Safety
The caller must ensure that buf contains exactly one complete TPM
response frame.
Sourcepub fn cast_mut(buf: &mut [u8]) -> TpmResult<&mut Self>
pub fn cast_mut(buf: &mut [u8]) -> TpmResult<&mut Self>
Casts a mutable byte slice into a mutable TPM response wire view.
§Errors
Returns Err(TpmError) when the response envelope is malformed.
Sourcepub fn cast_prefix_mut(buf: &mut [u8]) -> TpmResult<(&mut Self, &mut [u8])>
pub fn cast_prefix_mut(buf: &mut [u8]) -> TpmResult<(&mut Self, &mut [u8])>
Casts the first mutable TPM response frame in a byte slice into a wire view.
§Errors
Returns Err(TpmError) when the response envelope is malformed or
incomplete.
Sourcepub unsafe fn cast_mut_unchecked(buf: &mut [u8]) -> &mut Self
pub unsafe fn cast_mut_unchecked(buf: &mut [u8]) -> &mut Self
Casts a mutable byte slice into a mutable TPM response wire view without validation.
§Safety
The caller must ensure that buf contains exactly one complete TPM
response frame. The returned reference inherits the exclusive access
represented by buf.
Sourcepub fn as_bytes_mut(&mut self) -> &mut [u8]
pub fn as_bytes_mut(&mut self) -> &mut [u8]
Returns the mutable response frame bytes.
Sourcepub fn body_mut(&mut self) -> &mut [u8]
pub fn body_mut(&mut self) -> &mut [u8]
Returns the mutable response body bytes after the TPM header.