pub struct Connection { /* private fields */ }Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn new(endpoint: &SocketAddr) -> Result<Self, ClientError>
pub async fn new(endpoint: &SocketAddr) -> Result<Self, ClientError>
Establish a connection to the given socket address.
§Examples
use rocketmq_client::connection::Connection;
use std::net::SocketAddr;
#[tokio::main]
fn main() {
let endpoint = "127.0.0.1:80";
let socket_addr = endpoint.parse::<std::net::SocketAddr>().unwrap();
let connection = rocketmq_client::connection::Connection::new(&socket_addr).await.unwrap();
}
§Errors
Raise ClientError::ConnectTimeout if connection may not be established within reasonable amount of time.
pub async fn read_frame(&mut self) -> Result<Option<Frame>, ClientError>
pub async fn write_frame(&mut self, frame: &Frame) -> Result<(), ClientError>
Auto Trait Implementations§
impl !Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
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