Skip to content

v0.1.27

Choose a tag to compare

@decebal decebal released this 02 Apr 00:51
· 2 commits to main since this release
82362ea

Fixed

  • E0275 still triggered with 600+ handlers despite v0.1.26 type erasure (#58) — The v0.1.26 fix reduced impl Handler blocks from N to 1, but the register_* methods remained generic — each call still monomorphized ErasedHandler::with_args<F,T,Fut,R>(). At ~643 handlers the cumulative trait-resolution pressure still overflowed E0275. This release provides a fully non-generic registration path where the compiler sees only concrete types at each call site, eliminating generic monomorphization entirely.

Added

  • ErasedHandler::from_closure() / ErasedStreamHandler::from_closure() — Public non-generic constructors that accept pre-boxed closures directly.
  • Router::register_erased() / Router::register_streaming_erased() — Non-generic registration methods with zero monomorphization at the call site.
  • erase_handler! macro family (8 macros) — Declarative macros that generate fully concrete boxing code.
  • register_handlers_erased! batch macro — Register multiple handlers at once with a clean declarative syntax.

Migration

// Before (generic, causes monomorphization):
router.register_result_with_args("get_user", get_user);

// After (non-generic, zero monomorphization):
router.register_erased("get_user", erase_handler_with_args!(get_user, GetUserArgs));

// Or use the batch macro:
register_handlers_erased!(router, {
    "health"      => health(),
    "get_user"    => get_user(args: GetUserArgs),
    "update_user" => update_user(state: AppState, args: UpdateArgs),
    "db_status"   => db_status(state: AppState),
    "events"      => stream event_stream(),
});

See full CHANGELOG and migration guide for details.