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>
impl<'a> UnsafeUnpin for DynRenderOutcome<'a>where
&'static str: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
String: UnsafeUnpin,
*const ArcInner<HeadFailure> is !null: UnsafeUnpin,
PhantomData<ArcInner<HeadFailure>>: UnsafeUnpin,
*const dyn Future<Output = Result<(), WriteError>> + 'a is !null: UnsafeUnpin,
PhantomData<dyn Future<Output = Result<(), WriteError>> + 'a>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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