Struct crypto_auditing::event_broker::Client
source · pub struct Client { /* private fields */ }Expand description
A client to the event broker service
Examples
use crypto_auditing::event_broker::Client;
use futures::stream::StreamExt;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::new().scopes(&vec!["tcp".to_string()]);
let (_handle, mut reader) = client.start().await?;
tokio::spawn(async move {
while let Some(event) = reader.next().await {
println!("{:?}", &event);
}
});
tokio::signal::ctrl_c().await?;
Ok(())
}Implementations§
source§impl Client
impl Client
sourcepub fn address(self, address: impl AsRef<Path>) -> Self
pub fn address(self, address: impl AsRef<Path>) -> Self
Sets the Unix domain address of event broker
sourcepub fn scopes(self, scopes: &Vec<String>) -> Self
pub fn scopes(self, scopes: &Vec<String>) -> Self
Sets the scopes to restrict matches of events
sourcepub async fn start(
self
) -> Result<(ClientHandle, impl Stream<Item = EventGroup>)>
pub async fn start( self ) -> Result<(ClientHandle, impl Stream<Item = EventGroup>)>
Starts driving the client connection.
This returns a tuple consisting a ClientHandle and a [Stream]
which generates a sequence of event groups.
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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