Struct EventSpec
pub struct EventSpec {
pub name: String,
pub version: u32,
pub schema: Value,
pub visibility: Visibility,
}Expand description
A custom event as it is declared: the name it is emitted under, the version of its data, the JSON Schema of its data (what a consumer reads; the loop bounds the data’s size, it does not validate against the schema) and who may see it.
Fields§
§name: Stringns.name, up to five segments, each [a-z][a-z0-9_]*, the namespace not a core one.
version: u32The version of the event’s data, at least 1.
schema: ValueThe JSON Schema of the data.
visibility: VisibilityWho may see the event.
Implementations§
§impl EventSpec
impl EventSpec
pub fn new(name: impl Into<String>) -> EventSpec
pub fn new(name: impl Into<String>) -> EventSpec
An event called name: version 1, any data, Visibility::Hooks.
pub fn published(self) -> EventSpec
pub fn published(self) -> EventSpec
The same event, sent to clients too (Visibility::Clients).
pub fn with_version(self, version: u32) -> EventSpec
pub fn with_version(self, version: u32) -> EventSpec
The same event with the version of its data.
pub fn with_schema(self, schema: Value) -> EventSpec
pub fn with_schema(self, schema: Value) -> EventSpec
The same event with the JSON Schema of its data.
pub fn with_visibility(self, visibility: Visibility) -> EventSpec
pub fn with_visibility(self, visibility: Visibility) -> EventSpec
The same event with visibility.
pub fn validate(&self) -> Result<(), DeclarationError>
pub fn validate(&self) -> Result<(), DeclarationError>
Whether the declaration is allowed: a name of the right shape outside the core namespaces, and a version of at least 1.
§Errors
DeclarationError::Reserved, DeclarationError::BadName or
DeclarationError::BadVersion.
Trait Implementations§
impl StructuralPartialEq for EventSpec
Auto Trait Implementations§
impl Freeze for EventSpec
impl RefUnwindSafe for EventSpec
impl Send for EventSpec
impl Sync for EventSpec
impl Unpin for EventSpec
impl UnsafeUnpin for EventSpec
impl UnwindSafe for EventSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].