pub struct ProtocolDescriptor {
pub descriptor_version: u32,
pub namespace: String,
pub version: u32,
pub types: TypeTable,
pub state: Vec<StateField>,
pub commands: Vec<CommandSpec>,
pub events: Vec<EventSpec>,
pub modules: Vec<String>,
}Expand description
The complete, versioned description of one application protocol: its types, read-only state snapshot and command catalog.
Fields§
§descriptor_version: u32§namespace: String§version: u32Catalog version chosen by the application.
types: TypeTable§state: Vec<StateField>§commands: Vec<CommandSpec>§events: Vec<EventSpec>Events this protocol emits, in declaration order.
modules: Vec<String>Namespaces of the modules composed into this catalog, in order. Their commands keep their own namespace in their ids, and each module’s state is the state field of the same name.
Implementations§
Source§impl ProtocolDescriptor
impl ProtocolDescriptor
pub fn command(&self, id: &str) -> Option<(usize, &CommandSpec)>
Sourcepub fn command_symbol(&self, command: &CommandSpec) -> String
pub fn command_symbol(&self, command: &CommandSpec) -> String
A name for command that is unique in this catalog, for generated
code: the command’s own name in the application’s namespace, the
namespace and name joined by _ in a module’s, such as
downloads_add.
pub fn state_index(&self, name: &str) -> Option<usize>
Sourcepub fn fingerprint(&self) -> u64
pub fn fingerprint(&self) -> u64
Stable fingerprint of the full descriptor. Peers compare it during the handshake so a stale client cannot silently use another catalog.
pub fn validate(&self) -> Result<(), DescriptorError>
Trait Implementations§
Source§impl Clone for ProtocolDescriptor
impl Clone for ProtocolDescriptor
Source§impl Debug for ProtocolDescriptor
impl Debug for ProtocolDescriptor
Source§impl<'de> Deserialize<'de> for ProtocolDescriptor
impl<'de> Deserialize<'de> for ProtocolDescriptor
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ProtocolDescriptor
Source§impl PartialEq for ProtocolDescriptor
impl PartialEq for ProtocolDescriptor
Source§impl Serialize for ProtocolDescriptor
impl Serialize for ProtocolDescriptor
impl StructuralPartialEq for ProtocolDescriptor
Auto Trait Implementations§
impl Freeze for ProtocolDescriptor
impl RefUnwindSafe for ProtocolDescriptor
impl Send for ProtocolDescriptor
impl Sync for ProtocolDescriptor
impl Unpin for ProtocolDescriptor
impl UnsafeUnpin for ProtocolDescriptor
impl UnwindSafe for ProtocolDescriptor
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
Mutably borrows from an owned value. Read more