Skip to content

RustUse/use-event

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

RustUse/use-event

Composable sets of primitive Rust utility crates for fellow crustaceans.

use-event is a dependency-free RustUse workspace for small event vocabulary primitives: identifiers, names, kinds, status labels, sources, targets, payload wrappers, metadata, timestamps, envelopes, handlers, dispatch outcomes, streams, and logs. The top-level use-event crate is a feature-gated facade and re-export crate only; implementation lives in focused crates under crates/.

Experimental v0.1.0

This workspace is experimental. APIs are intentionally small and may change before a wider stable release line. Use the focused crates when you want the narrowest dependency surface, or use the facade when one import surface is more convenient.

What This Is

  • Primitive event vocabulary types for Rust applications and libraries.
  • Synchronous, dependency-free building blocks that compose with your own runtime or framework.
  • A facade crate with opt-in features and explicit nested module re-exports.

What This Is Not

  • Not an event bus, broker, queue, scheduler, runtime, or persistence layer.
  • Not a domain-event framework or message framework.
  • Not a UUID, clock policy, serialization, async, or distributed-systems abstraction.

Child Crates

Crate Purpose
use-event Facade crate with feature-gated re-exports
use-event-id Lightweight event id newtype
use-event-name Lightweight event name newtype
use-event-kind Standard event kind labels plus custom labels
use-event-status Event lifecycle status labels
use-event-source Event source label newtype
use-event-target Event target label newtype
use-event-payload Generic payload wrapper
use-event-metadata Ordered string metadata entries
use-event-timestamp SystemTime timestamp wrapper
use-event-envelope Generic envelope composed from focused primitives
use-event-handler Synchronous handler trait and closure blanket impl
use-event-dispatch Dispatch status and outcome primitives
use-event-stream Ordered in-memory event stream wrapper
use-event-log Append-only in-memory event log wrapper

Install

Facade crate with all default features:

[dependencies]
use-event = "0.1.0"

Facade with selected features:

[dependencies]
use-event = { version = "0.1.0", default-features = false, features = ["envelope", "log"] }

Focused crate only:

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

Before the first crates.io release, use a Git dependency pinned to a commit:

[dependencies]
use-event = { git = "https://github.com/RustUse/use-event", rev = "<commit>" }

Quick Examples

Create an envelope through the facade:

use use_event::{EventEnvelope, EventKind, EventName, EventSource};

let event = EventEnvelope::new(
    EventName::new("command.started"),
    EventKind::Started,
    EventSource::new("cli"),
    "rustuse build",
);

assert_eq!(event.name.as_str(), "command.started");
assert_eq!(event.kind.as_str(), "started");
assert_eq!(event.payload, "rustuse build");

Append event names to a log:

use use_event::{EventLog, EventName};

let mut log = EventLog::new();
log.append(EventName::new("test.started"));
log.append(EventName::new("test.passed"));

assert_eq!(log.len(), 2);

Development

cargo fmt --all
cargo check --workspace --all-features --examples
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors