Trait moveit::ctor::TryCtor[][src]

#[must_use = "`Ctor`s do nothing until emplaced into storage"]
pub unsafe trait TryCtor {
    type Output;
    type Error;
    unsafe fn try_ctor(
        self,
        dest: Pin<&mut MaybeUninit<Self::Output>>
    ) -> Result<(), Self::Error>; }

An in-place constructor for a particular type, which can potentially fail.

Emplacing a TryCtor may allocate even when construction fails; prefer to use Result<impl Ctor> when possible, instead.

Safety

TryCtor::try_ctor() must leave its destination argument in a valid, initialized state when it returns Ok.

Associated Types

type Output[src]

The type to construct.

type Error[src]

The error the construction operation may return.

Loading content...

Required methods

unsafe fn try_ctor(
    self,
    dest: Pin<&mut MaybeUninit<Self::Output>>
) -> Result<(), Self::Error>
[src]

Try to construct a new value using the arguments stored in self.

Safety

dest must be freshly-created memory; this function must not be used to mutate a previously-pinned pointer that has had self: Pin functions called on it.

Loading content...

Implementors

impl<C: Ctor> TryCtor for C[src]

type Output = C::Output

type Error = Infallible

Loading content...