Enum git_packetline::PacketLineRef
source · [−]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 more
sourceimpl<'a> Debug for PacketLineRef<'a>
impl<'a> Debug for PacketLineRef<'a>
sourceimpl<'a> Hash for PacketLineRef<'a>
impl<'a> Hash for PacketLineRef<'a>
sourceimpl<'a> Ord for PacketLineRef<'a>
impl<'a> Ord for PacketLineRef<'a>
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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PacketLineRef<'a>) -> bool
fn ne(&self, other: &PacketLineRef<'a>) -> bool
This method tests for !=
.
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>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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 more
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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more