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(TpmProtocolError) when the response envelope is malformed.
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(TpmProtocolError) when the response envelope is malformed.
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 rc(&self) -> TpmResult<TpmRc>
pub fn rc(&self) -> TpmResult<TpmRc>
Returns the response code.
§Errors
Returns Err(TpmProtocolError) when the response code is malformed.
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.