Struct il2_utils::mem::SecretBytes[][src]

pub struct SecretBytes { /* fields omitted */ }
Expand description

This struct wraps a byte array that is guaranteed to have its contents shredded upon destruction.

It also allows the locking of the value in memory if required, preventing it from being moved into the disk.

This struct also implements a mechanism to set a logical length that differs

Implementations

Creates a new SecretBytes.

Arguments:

  • size: The size in bytes;
  • locked: Locks the value in memory;

Creates a new SecretBytes and initializes it with the given value.

Arguments:

  • value: The initial value;
  • locked: Locks the value in memory;

Returns the value as a mutable byte slice.

Returns the value as an immutable byte slice.

Returns the buffer as a mutable byte slice. The buffer may be larger than the value itself.

Returns the buffer as an immutable byte slice. The buffer may be larger than the value itself.

Returns true if the value is locked in memory or false otherwise.

Returns the logical size of this value. It may be equal or smaller than the actual buffer size.

Sets the logical size of this value. If the new size is larger than the buffer size, this method will set the logical size to the current buffer size.

Arguments:

  • size: The logical size of the value.

Returns true if this value has length 0.

Returns the size of the inner buffer of this value.

Verifies if the underlying platform supports memory locking.

Returns true if locking is supported or false otherwise.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.