Struct Custom

#[repr(align(4))]
pub struct Custom { pub(in ::io::error) kind: ErrorKind, pub(in ::io::error) error: NonNull<dyn Error + Send + Sync>, pub(in ::io::error) error_drop: unsafe fn(NonNull<dyn Error + Send + Sync>), pub(in ::io::error) outer_drop: unsafe fn(NonNull<Self>) }

A user-created allocated error.

Fields

kind: ErrorKind
error: NonNull<dyn Error + Send + Sync>

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

error_drop: unsafe fn(NonNull<dyn Error + Send + Sync>)
outer_drop: unsafe fn(NonNull<Self>)

Call to drop a pointer to Custom.

Implementations

impl Custom

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

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).
fn into_raw(self) -> NonNull<dyn Error + Send + Sync>
fn error_ref(&self) -> &dyn Error + Send + Sync + 'static
fn error_mut(&mut self) -> &mut dyn Error + Send + Sync + 'static

Trait Implementations

impl Debug for Custom

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

impl Drop for Custom

fn drop(&mut self)

impl Send for Custom

impl Sync for Custom