Enum gix_packetline::PacketLineRef
source · 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<'a> PacketLineRef<'a>
impl<'a> PacketLineRef<'a>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)