[][src]Struct binary_enclave::Enclave

pub struct Enclave<T, const SIZE: usize>(_, _);

Our enclave that will store the serialized value within our binary

The Enclave defines the type we are serializing into the binary and also must be given a size for making room in the binary. If the serialized type is larger than this, the write will fail.

The size given will increase the size of the binary linearly. Setting this to an extremely large size will give you an extremely large binary.


impl<T, const SIZE: usize> Enclave<T, SIZE> where
    T: Default + Serialize + DeserializeOwned + EnclaveLocator, 

pub const fn new() -> Self[src]

Gives us a new Enclave with the size specified.

pub fn decode(&self) -> T[src]

Deserialize the embedded Enclave into an instance of our specified type.

pub fn write(&self, payload: &T) -> Result<usize>[src]

Write a new payload into the binary. This takes place by copying the binary, writing our payload into it, and moving the new binary overtop the current. This is required due to restrictions on some OS of modifying a binary currently being executing.

Auto Trait Implementations

impl<const SIZE: usize, T> RefUnwindSafe for Enclave<T, SIZE> where
    T: RefUnwindSafe

impl<const SIZE: usize, T> Send for Enclave<T, SIZE> where
    T: Send

impl<const SIZE: usize, T> Sync for Enclave<T, SIZE> where
    T: Sync

impl<const SIZE: usize, T> Unpin for Enclave<T, SIZE> where
    T: Unpin

impl<const SIZE: usize, T> UnwindSafe for Enclave<T, SIZE> where
    T: UnwindSafe

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.