Skip to main content

Crate use_event_handler

Crate use_event_handler 

Source
Expand description

§use-event-handler

Synchronous event handler trait for RustUse event primitives.

§Install

[dependencies]
use-event-handler = "0.1.0"

§Example

use core::convert::Infallible;
use use_event_handler::EventHandler;

let handler = |event: &str| -> Result<usize, Infallible> { Ok(event.len()) };

assert_eq!(handler.handle("command.started"), Ok(15));

§Scope

  • Define a small synchronous handler trait.
  • Support closures and functions through a blanket implementation.
  • Keep output and error types caller-defined.

§Non-Goals

  • No async runtime.
  • No scheduling, queueing, or dispatch loop.
  • No middleware or framework behavior.

§Status

Experimental v0.1.0 primitive.

§License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

Traits§

EventHandler