pub struct Frame {
pub command: String,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
}Expand description
One STOMP frame (command + headers + body).
Headers are a list, not a map: duplicates are kept, and
Self::header returns the first match. The body is not UTF-8
checked.
Fields§
§command: String§headers: Vec<(String, String)>§body: Vec<u8>Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new(command: impl Into<String>) -> Self
pub fn new(command: impl Into<String>) -> Self
An empty frame with this command and no headers or body.
Sourcepub fn with_header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Appends a header. Does not replace an existing name.
Sourcepub fn with_body(self, body: impl Into<Vec<u8>>) -> Self
pub fn with_body(self, body: impl Into<Vec<u8>>) -> Self
Replaces the body. Does not set content-length; Self::encode
adds that if the headers do not already name it.
Trait Implementations§
Source§impl Display for Frame
The command only. Use Frame::encode for the wire form.
impl Display for Frame
The command only. Use Frame::encode for the wire form.
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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