pub struct SimpleClient { /* private fields */ }Expand description
简化的客户端实例
Implementations§
Source§impl SimpleClient
impl SimpleClient
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
断开连接
Sourcepub async fn send_frame(&mut self, frame: &Frame) -> Result<()>
pub async fn send_frame(&mut self, frame: &Frame) -> Result<()>
发送消息
Sourcepub async fn send_frame_and_wait(
&mut self,
frame: &Frame,
timeout: Duration,
) -> Result<Frame>
pub async fn send_frame_and_wait( &mut self, frame: &Frame, timeout: Duration, ) -> Result<Frame>
发送并等待响应(按 message_id 匹配)
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
检查连接状态
Sourcepub async fn connection_id(&self) -> Option<String>
pub async fn connection_id(&self) -> Option<String>
获取连接 ID
Sourcepub fn active_protocol(&self) -> TransportProtocol
pub fn active_protocol(&self) -> TransportProtocol
获取活动协议
Sourcepub async fn parser_snapshot(&self) -> MessageParser
pub async fn parser_snapshot(&self) -> MessageParser
获取当前消息解析器快照(协商完成后与 flare_chat_server 等 Flare 服务端一致)
Sourcepub async fn wait_for_negotiation(&self, timeout: Duration) -> Result<()>
pub async fn wait_for_negotiation(&self, timeout: Duration) -> Result<()>
等待 CONNECT_ACK 协商完成
Auto Trait Implementations§
impl !RefUnwindSafe for SimpleClient
impl !UnwindSafe for SimpleClient
impl Freeze for SimpleClient
impl Send for SimpleClient
impl Sync for SimpleClient
impl Unpin for SimpleClient
impl UnsafeUnpin for SimpleClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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