Skip to main content

context

Macro context 

Source
context!() { /* proc-macro */ }
Expand description

Generates a context reference binding statement.

This function-like procedural macro generates a let statement that converts a context pointer into a mutable reference to ::hyperlane::Context. The conversion is performed through the Into trait with an intermediate conversion to usize.

§Arguments

  • TokenStream - The input token stream containing a single identifier that will be used as the variable name in the generated let statement.

§Returns

  • TokenStream - A let statement binding the specified variable name to a &mut ::hyperlane::Context obtained through pointer conversion.

§Example

use hyperlane::*;
use hyperlane_macros::*;

async fn example(ctx: &mut Context) {
    let new_ctx: &mut Context = context!(ctx);
    let _ = new_ctx.try_send().await;
}