| @@ -3,27 +3,27 @@ use bstr::BStr; · 2 unmodified lines |
| 3 | 3 | use crate::{decode, BandRef, Channel, ErrorRef, PacketLineRef, TextRef, ERR_PREFIX}; |
| 4 | 4 | |
| 5 | 5 | impl<'a> PacketLineRef<'a> { |
| 6 | | − /// Return this instance as slice if it's [`Data`][PacketLine::Data]. |
| 6 | + /// Return this instance as slice if it's [`Data`][PacketLineRef::Data]. |
| 7 | 7 | pub fn as_slice(&self) -> Option<&[u8]> { |
| 8 | 8 | match self { |
| 9 | 9 | PacketLineRef::Data(d) => Some(d), |
| 10 | 10 | PacketLineRef::Flush | PacketLineRef::Delimiter | PacketLineRef::ResponseEnd => None, |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | | − /// Return this instance's [`as_slice()`][PacketLine::as_slice()] as [`BStr`]. |
| 13 | + /// Return this instance's [`as_slice()`][PacketLineRef::as_slice()] as [`BStr`]. |
| 14 | 14 | pub fn as_bstr(&self) -> Option<&BStr> { |
| 15 | 15 | self.as_slice().map(Into::into) |
| 16 | 16 | } |
| 17 | | − /// Interpret this instance's [`as_slice()`][PacketLine::as_slice()] as [`Error`]. |
| 17 | + /// Interpret this instance's [`as_slice()`][PacketLineRef::as_slice()] as [`ErrorRef`]. |
| 18 | 18 | /// |
| 19 | 19 | /// This works for any data received in an error [channel][crate::Channel]. |
| 20 | 20 | /// |
| 21 | | − /// Note that this creates an unchecked error using the slice verbatim, which is useful to [serialize it][Error::write_to()]. |
| 22 | | − /// See [`check_error()`][PacketLine::check_error()] for a version that assures the error information is in the expected format. |
| 21 | + /// Note that this creates an unchecked error using the slice verbatim, which is useful to [serialize it][ErrorRef::write_to()]. |
| 22 | + /// See [`check_error()`][PacketLineRef::check_error()] for a version that assures the error information is in the expected format. |
| 23 | 23 | pub fn as_error(&self) -> Option<ErrorRef<'_>> { |
| 24 | 24 | self.as_slice().map(ErrorRef) |
| 25 | 25 | } |
| 26 | | − /// Check this instance's [`as_slice()`][PacketLine::as_slice()] is a valid [`Error`] and return it. |
| 26 | + /// Check this instance's [`as_slice()`][PacketLineRef::as_slice()] is a valid [`ErrorRef`] and return it. |
| 27 | 27 | /// |
| 28 | 28 | /// This works for any data received in an error [channel][crate::Channel]. |
| 29 | 29 | pub fn check_error(&self) -> Option<ErrorRef<'_>> { |
| @@ -40,10 +40,10 @@ impl<'a> PacketLineRef<'a> { · 10 unmodified lines |
| 40 | 40 | self.as_slice().map(Into::into) |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | | − /// Interpret the data in this [`slice`][PacketLine::as_slice()] as [`Band`] according to the given `kind` of channel. |
| 43 | + /// Interpret the data in this [`slice`][PacketLineRef::as_slice()] as [`BandRef`] according to the given `kind` of channel. |
| 44 | 44 | /// |
| 45 | 45 | /// Note that this is only relevant in a side-band channel. |
| 46 | | − /// See [`decode_band()`][PacketLine::decode_band()] in case `kind` is unknown. |
| 46 | + /// See [`decode_band()`][PacketLineRef::decode_band()] in case `kind` is unknown. |
| 47 | 47 | pub fn as_band(&self, kind: Channel) -> Option<BandRef<'_>> { |
| 48 | 48 | self.as_slice().map(|d| match kind { |
| 49 | 49 | Channel::Data => BandRef::Data(d), |
| @@ -52,7 +52,7 @@ impl<'a> PacketLineRef<'a> { · 2 unmodified lines |
| 52 | 52 | }) |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | | − /// Decode the band of this [`slice`][PacketLine::as_slice()], or panic if it is not actually a side-band line. |
| 55 | + /// Decode the band of this [`slice`][PacketLineRef::as_slice()], or panic if it is not actually a side-band line. |
| 56 | 56 | pub fn decode_band(&self) -> Result<BandRef<'_>, decode::band::Error> { |
| 57 | 57 | let d = self.as_slice().ok_or(decode::band::Error::NonDataLine)?; |
| 58 | 58 | Ok(match d[0] { |