[][src]Trait std::os::fortanix_sgx::usercalls::alloc::UserSafe

pub unsafe trait UserSafe {
    fn align_of() -> usize;
unsafe fn from_raw_sized_unchecked(ptr: *mut u8, size: usize) -> *mut Self; unsafe fn from_raw_sized(ptr: *mut u8, size: usize) -> NonNull<Self> { ... }
unsafe fn check_ptr(ptr: *const Self) { ... } }
🔬 This is a nightly-only experimental API. (sgx_platform #56975)

A type that can be represented in memory as one or more UserSafeSizeds.

Required methods

fn align_of() -> usize

🔬 This is a nightly-only experimental API. (sgx_platform #56975)

Equivalent to mem::align_of::<Self>.

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

🔬 This is a nightly-only experimental API. (sgx_platform #56975)

Construct a pointer to Self given a memory range in user space.

N.B., this takes a size, not a length!

Safety

The caller must ensure the memory range is in user memory, is the correct size and is correctly aligned and points to the right type.

Loading content...

Provided methods

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

🔬 This is a nightly-only experimental API. (sgx_platform #56975)

Construct a pointer to Self given a memory range.

N.B., this takes a size, not a length!

Safety

The caller must ensure the memory range points to the correct type.

Panics

This function panics if:

  • the pointer is not aligned.
  • the pointer is null.
  • the pointed-to range does not fit in the address space.
  • the pointed-to range is not in user memory.

unsafe fn check_ptr(ptr: *const Self)

🔬 This is a nightly-only experimental API. (sgx_platform #56975)

Checks if a pointer may point to Self in user memory.

Safety

The caller must ensure the memory range points to the correct type and length (if this is a slice).

Panics

This function panics if:

  • the pointer is not aligned.
  • the pointer is null.
  • the pointed-to range is not in user memory.
Loading content...

Implementors

impl<T: UserSafeSized> UserSafe for [T][src]

impl<T: UserSafeSized> UserSafe for T[src]

Loading content...