Skip to main content

ByteBuffer

Struct ByteBuffer 

Source
#[repr(C)]
pub struct ByteBuffer { pub data: *const u8, pub len: usize, }
🔬This is a nightly-only experimental API. (sgx_platform #56975)
Available on Fortanix and SGX only.
Expand description

An arbitrary-sized buffer of bytes in userspace, allocated by userspace.

This type is used when userspace may return arbitrary-sized data from a usercall. When reading from the buffer, if len is not 0, the enclave must ensure the entire buffer is in the user memory range. Once the enclave is done with the buffer, it should deallocate the buffer buffer by calling free(data, len, 1).

If len is 0, the enclave should ignore data. It should not call free.

Fields§

§data: *const u8
🔬This is a nightly-only experimental API. (sgx_platform #56975)
§len: usize
🔬This is a nightly-only experimental API. (sgx_platform #56975)

Trait Implementations§

Source§

impl Clone for ByteBuffer

Source§

fn clone(&self) -> ByteBuffer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ByteBuffer

Source§

impl Send for ByteBuffer

Source§

impl UserSafeSized for ByteBuffer

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UserSafe for T
where T: UserSafeSized,

Source§

fn align_of() -> usize

🔬This is a nightly-only experimental API. (sgx_platform #56975)
Available on Fortanix and SGX only.
Equivalent to align_of::<Self>.
Source§

unsafe fn from_raw_sized_unchecked(ptr: *mut u8, size: usize) -> *mut T

🔬This is a nightly-only experimental API. (sgx_platform #56975)
Available on Fortanix and SGX only.
Constructs a pointer to Self given a memory range in user space. Read more
Source§

unsafe fn from_raw_sized(ptr: *mut u8, size: usize) -> NonNull<Self>

🔬This is a nightly-only experimental API. (sgx_platform #56975)
Available on Fortanix and SGX only.
Constructs a pointer to Self given a memory range. Read more
Source§

unsafe fn check_ptr(ptr: *const Self)

🔬This is a nightly-only experimental API. (sgx_platform #56975)
Available on Fortanix and SGX only.
Checks if a pointer may point to Self in user memory. Read more
Source§

impl<T> UserSafeCopyDestination<T> for T

Source§

fn as_mut_ptr(&mut self) -> *mut T

🔬This is a nightly-only experimental API. (sgx_platform #56975)
Available on Fortanix and SGX only.
Returns a pointer for writing to the value.