BoxFuture

Type Alias BoxFuture 

Source
pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
Expand description

Type alias for boxed async return type (dyn-compatible).

This type is required because async trait methods cannot be object-safe. All handler methods return BoxFuture to allow handlers to be stored as trait objects in the agent.

§Example

use async_snmp::handler::{BoxFuture, GetResult};

fn example_async_fn<'a>(value: &'a i32) -> BoxFuture<'a, GetResult> {
    Box::pin(async move {
        // Async work here
        GetResult::Value(async_snmp::Value::Integer(*value))
    })
}

Aliased Type§

pub struct BoxFuture<'a, T> { /* private fields */ }