Module context

Module context 

Source
Expand description

Context type for modulink-rust Serializable, type-safe map for passing data between links.

§Shadowing Policy (Ergonomic APIs)

For ergonomic usage (Context), always use variable shadowing (e.g., let ctx = ctx.insert(...)) instead of mut. This prevents accidental mutation and is safer for async/concurrent code. See migration plan for details.

Example (ergonomic, shadowing):

use modulink_rs::context::Context;
let ctx = Context::new();
let ctx = ctx.insert("a", 1);
let ctx = ctx.insert("b", 2);

Advanced/generic APIs (ContextMutable) may use mut for performance, but must document the tradeoff.

Structs§

Context
ContextMutable