Skip to main content

MapInitError

Struct MapInitError 

Source
pub struct MapInitError<I, F, E, Mode = InitMode> { /* private fields */ }
Expand description

错误映射后的初始化器。 An initializer wrapper that converts the underlying initializer’s error.

只有初始化失败时才调用映射闭包;成功时保留原始析构凭证。 The mapping closure runs only on failure; on success, the original destruction receipt is preserved.

Trait Implementations§

Source§

impl<T, E1, E2, I, F, Mode> Init<T, E2, Mode> for MapInitError<I, F, E1, Mode>
where I: Init<T, E1, Mode>, F: FnOnce(E1) -> E2,

Source§

fn initialize<'slot>( self, slot: InitSlot<'slot, T, Mode>, ) -> Result<InitReceipt<'slot, T, Mode>, E2>

消耗目标槽位并返回已初始化值的析构凭证。 Consume the target slot and return a destruction receipt for the initialized value.
Source§

fn map_err<F, E2>(self, map: F) -> MapInitError<Self, F, E, Mode>
where Self: Sized, F: FnOnce(E) -> E2,

将初始化器的错误映射为另一种错误类型,同时保留地址模式。 Map the initializer’s error to another type while preserving its address mode. Read more

Auto Trait Implementations§

§

impl<I, F, E, Mode> Freeze for MapInitError<I, F, E, Mode>
where I: Freeze, F: Freeze, PhantomData<fn(E)>: Freeze, PhantomData<fn() -> Mode>: Freeze,

§

impl<I, F, E, Mode> RefUnwindSafe for MapInitError<I, F, E, Mode>

§

impl<I, F, E, Mode> Send for MapInitError<I, F, E, Mode>
where I: Send, F: Send, PhantomData<fn(E)>: Send, PhantomData<fn() -> Mode>: Send,

§

impl<I, F, E, Mode> Sync for MapInitError<I, F, E, Mode>
where I: Sync, F: Sync, PhantomData<fn(E)>: Sync, PhantomData<fn() -> Mode>: Sync,

§

impl<I, F, E, Mode> Unpin for MapInitError<I, F, E, Mode>
where I: Unpin, F: Unpin, PhantomData<fn(E)>: Unpin, PhantomData<fn() -> Mode>: Unpin,

§

impl<I, F, E, Mode> UnsafeUnpin for MapInitError<I, F, E, Mode>

§

impl<I, F, E, Mode> UnwindSafe for MapInitError<I, F, E, Mode>

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> 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, 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.