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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
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