pub struct Producer { /* private fields */ }Expand description
A simple Franz Producer that sends messages to the broker.
Note: This producer does not use any internal buffering!
ⓘ
use franz_client::{Producer, FranzClientError};
fn main() -> Result<(), FranzClientError> {
let mut producer = Producer::new("127.0.0.1:8085", "test")?;
producer.send_unbuffered("i was here! :3")?;
producer.flush()
}Implementations§
Source§impl Producer
impl Producer
pub fn new( broker: impl ToSocketAddrs, topic: &str, ) -> Result<Self, FranzClientError>
pub fn send<D: AsRef<[u8]>>(&mut self, msg: D) -> Result<(), FranzClientError>
pub fn send_unbuffered<D: AsRef<[u8]>>( &mut self, msg: D, ) -> Result<(), FranzClientError>
pub fn flush(&mut self) -> Result<(), FranzClientError>
Auto Trait Implementations§
impl Freeze for Producer
impl RefUnwindSafe for Producer
impl Send for Producer
impl Sync for Producer
impl Unpin for Producer
impl UnwindSafe for Producer
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