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.
Returns true
if the data was converted to a Message
and added
to the inbox, or false
otherwise.
§Errors
- returns a
ProtocolError::AlreadySubscribed
if we saw an unexpected ACK. - returns a
ProtocolError::UnexpectedEventPayload
if 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::ZeekError
if an error was received from Zeek
Sourcepub fn publish_event<S>(
&mut self,
topic: S,
event: Event,
) -> Result<(), ProtocolError>
pub fn publish_event<S>( &mut self, topic: S, event: Event, ) -> Result<(), ProtocolError>
Enqueue an event for sending.
§Errors
Will return ProtocolError::SendOnNonSubscribed
if the binding is not subscribed to the
topic of the message.
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