pub enum PacketLineRef<'a> {
Data(&'a [u8]),
Flush,
Delimiter,
ResponseEnd,
}
Expand description
A borrowed packet line as it refers to a slice of data by reference.
Variants§
Data(&'a [u8])
A chunk of raw data.
Flush
A flush packet.
Delimiter
A delimiter packet.
ResponseEnd
The end of the response.
Implementations§
Source§impl PacketLineRef<'_>
impl PacketLineRef<'_>
Source§impl<'a> PacketLineRef<'a>
impl<'a> PacketLineRef<'a>
Sourcepub fn as_error(&self) -> Option<ErrorRef<'a>>
pub fn as_error(&self) -> Option<ErrorRef<'a>>
Interpret this instance’s as_slice()
as ErrorRef
.
This works for any data received in an error channel.
Note that this creates an unchecked error using the slice verbatim, which is useful to serialize it.
See check_error()
for a version that assures the error information is in the expected format.
Sourcepub fn check_error(&self) -> Option<ErrorRef<'a>>
pub fn check_error(&self) -> Option<ErrorRef<'a>>
Check this instance’s as_slice()
is a valid ErrorRef
and return it.
This works for any data received in an error channel.
Sourcepub fn as_text(&self) -> Option<TextRef<'a>>
pub fn as_text(&self) -> Option<TextRef<'a>>
Return this instance as text, with the trailing newline truncated if present.
Trait Implementations§
Source§impl<'a> Clone for PacketLineRef<'a>
impl<'a> Clone for PacketLineRef<'a>
Source§fn clone(&self) -> PacketLineRef<'a>
fn clone(&self) -> PacketLineRef<'a>
Returns a copy 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<'a> Debug for PacketLineRef<'a>
impl<'a> Debug for PacketLineRef<'a>
Source§impl<'de: 'a, 'a> Deserialize<'de> for PacketLineRef<'a>
impl<'de: 'a, 'a> Deserialize<'de> for PacketLineRef<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> Hash for PacketLineRef<'a>
impl<'a> Hash for PacketLineRef<'a>
Source§impl<'a> Ord for PacketLineRef<'a>
impl<'a> Ord for PacketLineRef<'a>
Source§fn cmp(&self, other: &PacketLineRef<'a>) -> Ordering
fn cmp(&self, other: &PacketLineRef<'a>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialEq for PacketLineRef<'a>
impl<'a> PartialEq for PacketLineRef<'a>
Source§impl<'a> PartialOrd for PacketLineRef<'a>
impl<'a> PartialOrd for PacketLineRef<'a>
Source§impl<'a> Serialize for PacketLineRef<'a>
impl<'a> Serialize for PacketLineRef<'a>
impl<'a> Copy for PacketLineRef<'a>
impl<'a> Eq for PacketLineRef<'a>
impl<'a> StructuralPartialEq for PacketLineRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for PacketLineRef<'a>
impl<'a> RefUnwindSafe for PacketLineRef<'a>
impl<'a> Send for PacketLineRef<'a>
impl<'a> Sync for PacketLineRef<'a>
impl<'a> Unpin for PacketLineRef<'a>
impl<'a> UnwindSafe for PacketLineRef<'a>
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