pub struct Binding { /* private fields */ }Expand description
Protocol wrapper for a Zeek WebSocket connection.
See the module documentation for an introduction
Implementations§
Source§impl Binding
impl Binding
Sourcepub fn new<S>(subscriptions: S) -> Selfwhere
S: Into<Subscriptions>,
pub fn new<S>(subscriptions: S) -> Selfwhere
S: Into<Subscriptions>,
Create a new Binding with the given Subscriptions.
let conn = Binding::new(&["topic"]);Sourcepub fn handle_incoming(&mut self, message: Message) -> Result<(), ProtocolError>
pub fn handle_incoming(&mut self, message: Message) -> Result<(), ProtocolError>
Handle received message.
§Errors
- returns a
ProtocolError::AlreadySubscribedif we saw an unexpected ACK. - returns a
ProtocolError::UnexpectedEventPayloadif an unexpected event payload was seen
Sourcepub fn receive_event(
&mut self,
) -> Result<Option<(String, Event)>, ProtocolError>
pub fn receive_event( &mut self, ) -> Result<Option<(String, Event)>, ProtocolError>
Get the next incoming event.
§Errors
- returns a
ProtocolError::ZeekErrorif an error was received from Zeek
Sourcepub fn publish_event<S>(&mut self, topic: S, event: Event)
pub fn publish_event<S>(&mut self, topic: S, event: Event)
Enqueue an event for sending.
Auto Trait Implementations§
impl Freeze for Binding
impl RefUnwindSafe for Binding
impl Send for Binding
impl Sync for Binding
impl Unpin for Binding
impl UnwindSafe for Binding
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