pub struct ZmtpStream<S> { /* private fields */ }Expand description
ZMTP 3.1 framing over a byte stream.
Transport-only — no socket type semantics. Socket semantics live in QuicReq/QuicRep/etc.
Implementations§
Source§impl<S: AsyncRead + AsyncWrite + Unpin> ZmtpStream<S>
impl<S: AsyncRead + AsyncWrite + Unpin> ZmtpStream<S>
Sourcepub async fn handshake(
&mut self,
socket_type: ZmqSocketType,
is_server: bool,
) -> Result<()>
pub async fn handshake( &mut self, socket_type: ZmqSocketType, is_server: bool, ) -> Result<()>
Perform ZMTP greeting + NULL mechanism handshake.
§Arguments
socket_type- The ZMQ socket type (sent in READY metadata)is_server- Whether this side is the server (affects READY order)
§NULL Handshake Sequence (RFC 37)
- Both sides send 64-byte greeting (can overlap)
- Both sides read and validate peer greeting
- CLIENT sends READY command first
- Server reads client READY, validates, then sends READY
Sourcepub async fn recv_frame(&mut self) -> Result<ZmtpFrame>
pub async fn recv_frame(&mut self) -> Result<ZmtpFrame>
Receive one ZMTP frame (message or command).
Sourcepub async fn recv_command(&mut self) -> Result<ZmtpCommand>
pub async fn recv_command(&mut self) -> Result<ZmtpCommand>
Receive a command frame specifically (validates COMMAND bit set, MORE=0).
Sourcepub async fn send_command(&mut self, name: &str, body: &[u8]) -> Result<()>
pub async fn send_command(&mut self, name: &str, body: &[u8]) -> Result<()>
Send a ZMTP command frame (COMMAND bit set, MORE=0).
Delegates to zmtp_framing::encode_command for single source of truth.
Sourcepub async fn send_frame(&mut self, more: bool, data: &[u8]) -> Result<()>
pub async fn send_frame(&mut self, more: bool, data: &[u8]) -> Result<()>
Send one ZMTP message frame (COMMAND=0).
Delegates to zmtp_framing::encode_frame for single source of truth.
Sourcepub async fn send_multipart(&mut self, parts: &[Bytes]) -> Result<()>
pub async fn send_multipart(&mut self, parts: &[Bytes]) -> Result<()>
Send one ZMQ multipart message using ZMTP flags.
Sourcepub async fn recv_multipart(&mut self) -> Result<Multipart>
pub async fn recv_multipart(&mut self) -> Result<Multipart>
Receive one ZMQ multipart message, assembling frames via MORE flag.
Auto Trait Implementations§
impl<S> Freeze for ZmtpStream<S>where
S: Freeze,
impl<S> RefUnwindSafe for ZmtpStream<S>where
S: RefUnwindSafe,
impl<S> Send for ZmtpStream<S>where
S: Send,
impl<S> Sync for ZmtpStream<S>where
S: Sync,
impl<S> Unpin for ZmtpStream<S>where
S: Unpin,
impl<S> UnsafeUnpin for ZmtpStream<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for ZmtpStream<S>where
S: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more