Enum git_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
sourceimpl<'a> PacketLineRef<'a>
impl<'a> PacketLineRef<'a>
sourceimpl<'a> PacketLineRef<'a>
impl<'a> PacketLineRef<'a>
sourcepub fn as_error(&self) -> Option<ErrorRef<'_>>
pub fn as_error(&self) -> Option<ErrorRef<'_>>
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<'_>>
pub fn check_error(&self) -> Option<ErrorRef<'_>>
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<'_>>
pub fn as_text(&self) -> Option<TextRef<'_>>
Return this instance as text, with the trailing newline truncated if present.
Trait Implementations
sourceimpl<'a> Clone for PacketLineRef<'a>
impl<'a> Clone for PacketLineRef<'a>
sourcefn clone(&self) -> PacketLineRef<'a>
fn clone(&self) -> PacketLineRef<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<'a> Debug for PacketLineRef<'a>
impl<'a> Debug for PacketLineRef<'a>
sourceimpl<'de: 'a, 'a> Deserialize<'de> for PacketLineRef<'a>
impl<'de: 'a, 'a> Deserialize<'de> for PacketLineRef<'a>
sourcefn 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
sourceimpl<'a> Hash for PacketLineRef<'a>
impl<'a> Hash for PacketLineRef<'a>
sourceimpl<'a> Ord for PacketLineRef<'a>
impl<'a> Ord for PacketLineRef<'a>
sourcefn cmp(&self, other: &PacketLineRef<'a>) -> Ordering
fn cmp(&self, other: &PacketLineRef<'a>) -> Ordering
1.21.0 · sourcefn 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
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a> PartialEq<PacketLineRef<'a>> for PacketLineRef<'a>
impl<'a> PartialEq<PacketLineRef<'a>> for PacketLineRef<'a>
sourcefn eq(&self, other: &PacketLineRef<'a>) -> bool
fn eq(&self, other: &PacketLineRef<'a>) -> bool
sourceimpl<'a> PartialOrd<PacketLineRef<'a>> for PacketLineRef<'a>
impl<'a> PartialOrd<PacketLineRef<'a>> for PacketLineRef<'a>
sourcefn partial_cmp(&self, other: &PacketLineRef<'a>) -> Option<Ordering>
fn partial_cmp(&self, other: &PacketLineRef<'a>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresourceimpl<'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> StructuralEq for PacketLineRef<'a>
impl<'a> StructuralPartialEq for PacketLineRef<'a>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more