Struct Contract
pub struct Contract {
pub name: &'static str,
pub version: &'static str,
pub requires: &'static [&'static Contract],
/* private fields */
}Expand description
A capability contract a bus may offer: its name, its version line and
the trait object type a bus answers for in Bus::capability. Each
contract crate exports one as CONTRACT
(bus_contract_journal::CONTRACT); a point names those it needs in
its table (PointDecl::needs) and
declare_all refuses it on a bus without them.
Two contracts are the same when their trait object types are: two semver-incompatible versions of a contract crate are two contracts, so a library on one is refused, with a reason, by a bus that implements the other.
Fields§
§name: &'static strThe contract’s name (journal), for messages and introspection.
version: &'static strThe version line of the crate that defines it (0.2).
requires: &'static [&'static Contract]The contracts a bus that offers this one offers too (crossing
requires journal); offers checks them.
Implementations§
§impl Contract
impl Contract
pub const fn new<C>(
name: &'static str,
version: &'static str,
requires: &'static [&'static Contract],
) -> Contractwhere
C: 'static + ?Sized,
pub const fn new<C>(
name: &'static str,
version: &'static str,
requires: &'static [&'static Contract],
) -> Contractwhere
C: 'static + ?Sized,
The contract name, version line version, offered by a bus that
answers for the trait object type C (dyn Journal).
pub fn type_id(&self) -> TypeId
pub fn type_id(&self) -> TypeId
The TypeId a bus answers for in Bus::capability.