pub struct TpmInt32(/* private fields */);Implementations§
Source§impl TpmInt32
impl TpmInt32
pub const fn new(value: i32) -> Self
pub const fn value(self) -> i32
pub const fn set(&mut self, value: i32)
pub const fn as_bytes(&self) -> &[u8; 4]
pub fn as_bytes_mut(&mut self) -> &mut [u8; 4]
pub fn to_be_bytes(self) -> [u8; 4]
pub const fn from_be_bytes(bytes: [u8; 4]) -> Self
Sourcepub fn cast(buf: &[u8]) -> TpmResult<&Self>
pub fn cast(buf: &[u8]) -> TpmResult<&Self>
Casts a byte slice into a TPM integer wire view.
§Errors
Returns UnexpectedEnd when
buf is smaller than this integer’s wire size.
Returns TrailingData when
buf is larger than this integer’s wire size.
Sourcepub fn validate(buf: &[u8]) -> TpmResult<()>
pub fn validate(buf: &[u8]) -> TpmResult<()>
Validates an exact TPM integer wire view.
§Errors
Returns UnexpectedEnd when
buf is smaller than this integer’s wire size.
Returns TrailingData when
buf is larger than this integer’s wire size.
Sourcepub fn validate_prefix(buf: &[u8]) -> TpmResult<()>
pub fn validate_prefix(buf: &[u8]) -> TpmResult<()>
Validates that buf starts with a TPM integer wire view.
§Errors
Returns UnexpectedEnd when
buf is smaller than this integer’s wire size.
Sourcepub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>
pub fn cast_prefix(buf: &[u8]) -> TpmResult<(&Self, &[u8])>
Casts the first bytes in a slice into a TPM integer wire view.
§Errors
Returns UnexpectedEnd when
buf is smaller than this integer’s wire size.
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 integer wire view.
§Errors
Returns UnexpectedEnd when
buf is smaller than this integer’s wire size.
Returns TrailingData when
buf is larger than this integer’s wire size.
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 bytes in a slice into a TPM integer wire view.
§Errors
Returns UnexpectedEnd when
buf is smaller than this integer’s wire size.
Source§impl TpmInt32
impl TpmInt32
Sourcepub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
pub unsafe fn cast_unchecked(buf: &[u8]) -> &Self
Casts a byte slice into this wire view without validation.
§Safety
The caller must ensure buf satisfies every invariant required by
the checked constructors for this view.
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 this wire view without validation.
§Safety
The caller must ensure buf satisfies every invariant required by
the checked constructors for this view. The returned reference
inherits the exclusive access represented by buf.