Trait moveit::new::TryNew[][src]

pub unsafe trait TryNew: Sized {
    type Output;
    type Error;
    unsafe fn try_new(
        self,
        this: Pin<&mut MaybeUninit<Self::Output>>
    ) -> Result<(), Self::Error>; fn with<F>(self, post: F) -> TryWith<Self, F> { ... } }
Expand description

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

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

Safety

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

Associated Types

The type to construct.

The error the construction operation may return.

Required methods

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

Safety

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

Provided methods

Adds a post-construction operation.

This function is analogous to New::with(); see its documentation for more information.

Note: The return value of this function should not be relied upon; a future version will replace it with impl TryNew.

Implementors