Skip to main content

DynRenderOutcome

Enum DynRenderOutcome 

Source
pub enum DynRenderOutcome<'a> {
    Done(Result<(), WriteError>),
    Pending(Pin<Box<dyn Future<Output = Result<(), WriteError>> + 'a>>),
}
Expand description

Boxed-future analogue of RenderOutcome used at the dyn-erasure boundary in DynWebRender.

§Why this exists: RPITIT and dyn-compatibility

RenderOutcome returns a concrete impl Future, using RPITIT (return-position impl Trait in trait): a trait method whose return type is -> impl SomeTrait. Each implementor produces its own concrete type for the impl Future slot, generated by the compiler from the body of render. This is great for static dispatch (no boxing, no virtual call) but it makes the trait not dyn-compatible — the compiler cannot put a single concrete future type into the vtable for dyn WebRender<::proa_core::NoLoader, ...> because every implementor’s future is a different type.

Box<dyn WebRender<L, B>> therefore does not compile. To preserve the sync/async split at the framework’s Box<dyn DynWebRender<::proa_core::NoLoader, ...>> boundary, this enum mirrors RenderOutcome with the Pending variant boxed into Pin<Box<dyn Future + 'a>> — a single concrete type that the vtable can carry.

Sync routes match Done and skip future allocation entirely. Async routes match Pending and .await the boxed future.

Variants§

§

Done(Result<(), WriteError>)

Render completed synchronously. No future was allocated.

§

Pending(Pin<Box<dyn Future<Output = Result<(), WriteError>> + 'a>>)

Render is async. The framework must .await the boxed future.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for DynRenderOutcome<'a>

§

impl<'a> !Send for DynRenderOutcome<'a>

§

impl<'a> !Sync for DynRenderOutcome<'a>

§

impl<'a> !UnwindSafe for DynRenderOutcome<'a>

§

impl<'a> Forget for DynRenderOutcome<'a>

§

impl<'a> Freeze for DynRenderOutcome<'a>
where &'static str: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, String: Freeze, *const ArcInner<HeadFailure> is !null: Freeze, PhantomData<ArcInner<HeadFailure>>: Freeze, *const dyn Future<Output = Result<(), WriteError>> + 'a is !null: Freeze, PhantomData<dyn Future<Output = Result<(), WriteError>> + 'a>: Freeze,

§

impl<'a> Move for DynRenderOutcome<'a>

§

impl<'a> Unpin for DynRenderOutcome<'a>
where &'static str: Unpin, *const u8 is !null: Unpin, String: Unpin, Arc<HeadFailure>: Unpin, Box<dyn Future<Output = Result<(), WriteError>> + 'a>: Unpin,

§

impl<'a> UnsafeUnpin for DynRenderOutcome<'a>

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more