[][src]Struct binary_enclave::Enclave

#[repr(C)]pub struct Enclave<T, const SIZE: usize> { /* fields omitted */ }

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.

Implementations

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

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

Gives us a new Enclave with the size specified.

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

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

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

Deserialize the embedded Enclave or give a default instance

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<T, const SIZE: usize> RefUnwindSafe for Enclave<T, SIZE> where
    T: RefUnwindSafe
[src]

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

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

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

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

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.