pub struct PointDecl {
pub id: &'static str,
pub kind: PointKind,
pub description: &'static str,
pub deadline: Option<Duration>,
pub fail_closed: bool,
pub needs: &'static [Capability],
pub budget: Option<Duration>,
pub journaled: bool,
pub relay: Option<Codec>,
pub version: u32,
/* private fields */
}Expand description
One line of a library’s contract table: a point it declares, built
from the point’s type in a const (PointDecl::of::<DocClose>(…)),
so the application can read what a library will host before building
anything. declare_all declares a table on a bus.
Fields§
§id: &'static strThe point’s id.
kind: PointKindWhat it is for.
description: &'static strWhat it does, for people and agents reading introspection.
deadline: Option<Duration>The deadline of its listeners that set none; None takes the
bus’s.
fail_closed: boolWhether a listener failure refuses the request
(PointSpec::fail_closed).
needs: &'static [Capability]The capabilities the point needs from the bus: declare_all
refuses it on a bus without them.
budget: Option<Duration>The time one pass of its listeners should take
(PointSpec::budget).
journaled: boolIts events go through the bus’s journal (PointSpec::journaled).
relay: Option<Codec>How it crosses a process, when it is relayable
(PointSpec::relay).
version: u32Its version, from 1 (PointSpec::version).
Implementations§
Source§impl PointDecl
impl PointDecl
Sourcepub const fn of<P: Point>(description: &'static str) -> PointDecl
pub const fn of<P: Point>(description: &'static str) -> PointDecl
The declaration of the point P, described by description.
Sourcepub const fn deadline(self, deadline: Duration) -> PointDecl
pub const fn deadline(self, deadline: Duration) -> PointDecl
The deadline of its listeners that set none.
Sourcepub const fn fail_closed(self) -> PointDecl
pub const fn fail_closed(self) -> PointDecl
A listener failure refuses the request
(PointSpec::fail_closed).
Sourcepub const fn needs(self, needs: &'static [Capability]) -> PointDecl
pub const fn needs(self, needs: &'static [Capability]) -> PointDecl
The capabilities the point needs from the bus
(.needs(&[Capability::Defer])).
Sourcepub const fn budget(self, budget: Duration) -> PointDecl
pub const fn budget(self, budget: Duration) -> PointDecl
The time one pass of its listeners should take
(PointSpec::budget); reported when over, never failed. It
needs no capability: on a bus without Timings it is only
shown.
Sourcepub const fn journaled(self) -> PointDecl
pub const fn journaled(self) -> PointDecl
Its events go through the bus’s journal: published with a number,
delivered after the publisher has moved on (Journal). For an
event point; declare_all refuses it on a bus without the
journal (Refused::Unsupported) and on another kind
(Refused::NotEvent).
Sourcepub const fn relayable(self, codec: Codec) -> PointDecl
pub const fn relayable(self, codec: Codec) -> PointDecl
The point crosses processes (Relay):
- an event point’s events, their input written and read by
codec(Codec::of::<P>()); journaled too; - a request point’s asks, from another process, their input and
value written and read by
codec(Codec::request::<P>()); fail-closed too, so no answer in time is a refusal.
declare_all refuses it on a bus without the relay
(Refused::Unsupported), on an alter or collect point and on a
request whose codec has no value (Refused::NotCrossable), and
with a codec of another point (Refused::TypeMismatch).
Sourcepub const fn version(self, version: u32) -> PointDecl
pub const fn version(self, version: u32) -> PointDecl
Its version, from 1 (PointSpec::version): raise it when the
payload changes in a way an older reader cannot use. Two
processes cross the point only at the same version.
Sourcepub fn required(&self) -> Vec<Capability>
pub fn required(&self) -> Vec<Capability>
The capabilities the point needs: those it names
(PointDecl::needs), then Capability::Journal when it is
journaled and Capability::Relay when it is relayable.
Sourcepub fn spec(&self) -> PointSpec
pub fn spec(&self) -> PointSpec
The point’s spec, as Bus::declare_point takes it.