Skip to main content

Custom

Struct Custom 

Source
#[doc(hidden)]
#[repr(align(4))]
pub struct Custom { kind: ErrorKind, error: NonNull<dyn Error + Send + Sync>, error_drop: unsafe fn(NonNull<dyn Error + Send + Sync>), outer_drop: unsafe fn(NonNull<Self>), }
🔬This is a nightly-only experimental API. (core_io_internals)
Expand description

A user-created allocated error.

Fields§

§kind: ErrorKind
🔬This is a nightly-only experimental API. (core_io_internals)
§error: NonNull<dyn Error + Send + Sync>
🔬This is a nightly-only experimental API. (core_io_internals)

Box<dyn Error + ...> without alloc.

§error_drop: unsafe fn(NonNull<dyn Error + Send + Sync>)
🔬This is a nightly-only experimental API. (core_io_internals)
§outer_drop: unsafe fn(NonNull<Self>)
🔬This is a nightly-only experimental API. (core_io_internals)

Call to drop a pointer to Custom.

Implementations§

Source§

impl Custom

Source

pub unsafe fn from_raw( kind: ErrorKind, error: NonNull<dyn Error + Send + Sync>, error_drop: unsafe fn(NonNull<dyn Error + Send + Sync>), outer_drop: unsafe fn(NonNull<Self>), ) -> Custom

🔬This is a nightly-only experimental API. (core_io_internals)
§Safety
  • error must be valid for up to a static lifetime, and own its pointee.
  • error_drop must be safe to call for the pointer error exactly once.
  • outer_drop must be safe to call on a pointer to this instance of Custom (the pointer is likely stored within a CustomOwner).
Source

pub fn into_raw(self) -> NonNull<dyn Error + Send + Sync>

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

fn error_ref(&self) -> &(dyn Error + Send + Sync + 'static)

🔬This is a nightly-only experimental API. (core_io #154046)
Source

fn error_mut(&mut self) -> &mut (dyn Error + Send + Sync + 'static)

🔬This is a nightly-only experimental API. (core_io #154046)

Trait Implementations§

Source§

impl Debug for Custom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Custom

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics #130494)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Custom

Source§

impl Sync for Custom