Trait FnResult

Source
pub trait FnResult<'a, T>: FnMarker {
    type Output;
}
Expand description

Trait for determining function result types.

This trait maps function markers to their corresponding result types. For synchronous functions, this is just the value type. For asynchronous functions, this wraps the value in a Future.

§Type Parameters

  • 'a - Lifetime parameter for the result
  • T - The base type that will be wrapped according to the marker

§Associated Types

  • Output - The actual result type (T for sync, Future<T> for async)

§Examples

use cel_cxx::marker::{FnMarker, FnResult};

fn result_example<'a, F, T>() -> F::Output
where
    F: FnMarker + FnResult<'a, T>,
{
    // Return type depends on the function marker
    todo!()
}

Required Associated Types§

Source

type Output

The output type for this function marker and base type.

Implementations on Foreign Types§

Source§

impl<'a, T> FnResult<'a, T> for ()

Synchronous function results.

For synchronous functions, the result type is just the base type.

Implementors§

Source§

impl<'a, T> FnResult<'a, T> for Async

Available on crate feature async only.

Asynchronous function results.

For asynchronous functions, the result type is wrapped in a BoxFuture. This allows async functions to return futures that can be awaited.

Source§

type Output = Pin<Box<dyn Future<Output = T> + Send + 'a>>