pub struct Interface {
pub name: String,
pub hash: String,
pub ir: ServiceIr,
pub methods: BTreeMap<String, String>,
pub schema: Box<PluginSchema>,
}Expand description
A peer’s shape, named and content-addressed: what <ns>.ir answers for
it, its hash, and each method’s own hash. Two interfaces with one hash
serve one shape (descriptions, grants and the name aside).
Fields§
§name: StringThe interface’s name: a contract’s namespace ("forge"), or the
peer’s own.
hash: StringThe shape’s hash: of every method’s own hash, by name.
ir: ServiceIrThe IR of the shape (IR 3.0, as <ns>.ir writes it).
methods: BTreeMap<String, String>Each method’s own hash, by name (Interface::method_hash).
schema: Box<PluginSchema>The schema the interface was read from: what a gate indexes for a typed slot (its methods’ grants, targets and roles).
Implementations§
Source§impl Interface
impl Interface
Sourcepub fn of(schema: &PluginSchema) -> Self
pub fn of(schema: &PluginSchema) -> Self
The interface of schema, named after its namespace.
Sourcepub fn named(name: &str, schema: &PluginSchema) -> Self
pub fn named(name: &str, schema: &PluginSchema) -> Self
The interface of schema, named name.
Sourcepub fn unknown(name: &str) -> Self
pub fn unknown(name: &str) -> Self
The interface of a peer that describes nothing (a hand-written router): no methods, an empty hash.
Sourcepub fn method_hash(m: &MethodSchema) -> String
pub fn method_hash(m: &MethodSchema) -> String
A method’s own hash: of its shape — its name, params, item, error, progress, cardinality, input and role — not its description, grant or hash, which say nothing of what crosses the wire.
Sourcepub fn schema(&self) -> &PluginSchema
pub fn schema(&self) -> &PluginSchema
The schema the interface was read from.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Interface
impl<'de> Deserialize<'de> for Interface
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Interface
Source§impl JsonSchema for Interface
impl JsonSchema for Interface
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Forget for Interface
impl Freeze for Interface
impl Move for Interface
impl RefUnwindSafe for Interface
impl Send for Interface
impl Sync for Interface
impl Unpin for Interface
impl UnsafeUnpin for Interface
impl UnwindSafe for Interface
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.