Skip to main content

PointDecl

Struct PointDecl 

Source
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>,
    /* 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 str

The point’s id.

§kind: PointKind

What it is for.

§description: &'static str

What 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: bool

Whether 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: bool

Its events go through the bus’s journal (PointSpec::journaled).

§relay: Option<Codec>

How its input crosses a process, when it is relayable (PointSpec::relay).

Implementations§

Source§

impl PointDecl

Source

pub const fn of<P: Point>(description: &'static str) -> PointDecl

The declaration of the point P, described by description.

Source

pub const fn deadline(self, deadline: Duration) -> PointDecl

The deadline of its listeners that set none.

Source

pub const fn fail_closed(self) -> PointDecl

A listener failure refuses the request (PointSpec::fail_closed).

Source

pub const fn needs(self, needs: &'static [Capability]) -> PointDecl

The capabilities the point needs from the bus (.needs(&[Capability::Defer])).

Source

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.

Source

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).

Source

pub const fn relayable(self, codec: Codec) -> PointDecl

Its events cross processes, their input written and read by codec (Codec::of::<P>()); journaled too. declare_all refuses it on a bus without the relay (Refused::Unsupported), on another kind (Refused::NotEvent), and with a codec of another point (Refused::TypeMismatch).

Source

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.

Source

pub fn key(&self) -> PointKey

The point’s key.

Source

pub fn spec(&self) -> PointSpec

The point’s spec, as Bus::declare_point takes it.

Trait Implementations§

Source§

impl Clone for PointDecl

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PointDecl

Source§

impl Debug for PointDecl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.