pub enum ReceivedFrame {
Frame(Frame),
Error(ServerError),
}Expand description
The result of receiving a frame from the server.
STOMP servers can send either normal frames (MESSAGE, RECEIPT, etc.) or ERROR frames indicating a problem. This enum allows callers to handle both cases with pattern matching.
§Example
ⓘ
use iridium_stomp::ReceivedFrame;
match conn.next_frame().await {
Some(ReceivedFrame::Frame(frame)) => {
println!("Got frame: {}", frame.command);
}
Some(ReceivedFrame::Error(err)) => {
eprintln!("Server error: {}", err);
}
None => {
println!("Connection closed");
}
}Variants§
Frame(Frame)
A normal STOMP frame (MESSAGE, RECEIPT, etc.)
Error(ServerError)
An ERROR frame from the server
Implementations§
Source§impl ReceivedFrame
impl ReceivedFrame
Sourcepub fn into_frame(self) -> Option<Frame>
pub fn into_frame(self) -> Option<Frame>
Returns the frame if this is a normal frame, or None if it’s an error.
Sourcepub fn into_error(self) -> Option<ServerError>
pub fn into_error(self) -> Option<ServerError>
Returns the error if this is an error frame, or None if it’s a normal frame.
Trait Implementations§
Source§impl Clone for ReceivedFrame
impl Clone for ReceivedFrame
Source§fn clone(&self) -> ReceivedFrame
fn clone(&self) -> ReceivedFrame
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReceivedFrame
impl Debug for ReceivedFrame
Source§impl PartialEq for ReceivedFrame
impl PartialEq for ReceivedFrame
impl Eq for ReceivedFrame
impl StructuralPartialEq for ReceivedFrame
Auto Trait Implementations§
impl Freeze for ReceivedFrame
impl RefUnwindSafe for ReceivedFrame
impl Send for ReceivedFrame
impl Sync for ReceivedFrame
impl Unpin for ReceivedFrame
impl UnsafeUnpin for ReceivedFrame
impl UnwindSafe for ReceivedFrame
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