pub struct WebSocketContract { /* private fields */ }Expand description
WebSocket contract implementation
Defines message types and topics for a WebSocket connection, enabling schema validation and drift detection.
Implementations§
Source§impl WebSocketContract
impl WebSocketContract
Sourcepub fn add_message_type(
&mut self,
message_type: WebSocketMessageType,
) -> Result<(), ContractError>
pub fn add_message_type( &mut self, message_type: WebSocketMessageType, ) -> Result<(), ContractError>
Add a message type to the contract
Sourcepub fn remove_message_type(&mut self, message_type_id: &str)
pub fn remove_message_type(&mut self, message_type_id: &str)
Remove a message type from the contract
Sourcepub fn get_message_types_for_topic(
&self,
topic: &str,
) -> Vec<&WebSocketMessageType>
pub fn get_message_types_for_topic( &self, topic: &str, ) -> Vec<&WebSocketMessageType>
Get message types for a specific topic
Trait Implementations§
Source§impl ProtocolContract for WebSocketContract
impl ProtocolContract for WebSocketContract
Source§fn contract_id(&self) -> &str
fn contract_id(&self) -> &str
Get a unique identifier for this contract
Source§fn operations(&self) -> Vec<ContractOperation>
fn operations(&self) -> Vec<ContractOperation>
Get all operations/methods/topics defined in this contract
Source§fn get_operation(&self, operation_id: &str) -> Option<&ContractOperation>
fn get_operation(&self, operation_id: &str) -> Option<&ContractOperation>
Get a specific operation by identifier
Source§fn diff<'life0, 'life1, 'async_trait>(
&'life0 self,
other: &'life1 dyn ProtocolContract,
) -> Pin<Box<dyn Future<Output = Result<ContractDiffResult, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn diff<'life0, 'life1, 'async_trait>(
&'life0 self,
other: &'life1 dyn ProtocolContract,
) -> Pin<Box<dyn Future<Output = Result<ContractDiffResult, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Compare this contract with another contract of the same protocol Read more
Source§fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation_id: &'life1 str,
request: &'life2 ContractRequest,
) -> Pin<Box<dyn Future<Output = Result<ValidationResult, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
operation_id: &'life1 str,
request: &'life2 ContractRequest,
) -> Pin<Box<dyn Future<Output = Result<ValidationResult, ContractError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Validate a request/message against this contract Read more
Auto Trait Implementations§
impl Freeze for WebSocketContract
impl !RefUnwindSafe for WebSocketContract
impl Send for WebSocketContract
impl Sync for WebSocketContract
impl Unpin for WebSocketContract
impl UnsafeUnpin for WebSocketContract
impl !UnwindSafe for WebSocketContract
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