Skip to main content

Occurrence

Trait Occurrence 

Source
pub trait Occurrence: Send + 'static {
    type Subject: Subject;
    type Kind: Kind;

    const TYPE_PREFIX: &'static str;

    // Required methods
    fn kind(&self) -> Self::Kind;
    fn subject(&self) -> Self::Subject;
    fn data(&self) -> Value;
}
Expand description

One thing an application promises to report.

The vocabulary lives with the application that owns it. This crate never interprets data; it only stamps it with an id, a time, and a type.

Required Associated Constants§

Source

const TYPE_PREFIX: &'static str

Prefix for every type an application emits, such as rushls.

Deliberately not reverse-DNS, and deliberately not configurable. The convention is a SHOULD in the specification and exists so producers sharing a bus can be told apart — a job source already does, since that is what an operator sets per deployment and what consumers deduplicate on. type is also what a consumer routes on, so letting an operator change it would break the very contract the name exists to keep.

Required Associated Types§

Required Methods§

Source

fn kind(&self) -> Self::Kind

Source

fn subject(&self) -> Self::Subject

Source

fn data(&self) -> Value

The CloudEvents data member, rendered once per occurrence.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§