History

[packetline #178] fix docs

Sebastian Thiel committed 5 years ago

Commit b3fd65d1 parent 23438fd2 files · +10 −10Browse files

Unified · Split

2 files
  1. git-packetline/src/line/mod.rs +9 −9
  2. git-packetline/src/read/mod.rs +1 −1
git-packetline/src/line/mod.rs+9−9
@@ -3,27 +3,27 @@ use bstr::BStr; · 2 unmodified lines
33 use crate::{decode, BandRef, Channel, ErrorRef, PacketLineRef, TextRef, ERR_PREFIX};
44
55 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].
77 pub fn as_slice(&self) -> Option<&[u8]> {
88 match self {
99 PacketLineRef::Data(d) => Some(d),
1010 PacketLineRef::Flush | PacketLineRef::Delimiter | PacketLineRef::ResponseEnd => None,
1111 }
1212 }
13− /// Return this instance's [`as_slice()`][PacketLine::as_slice()] as [`BStr`].
13+ /// Return this instance's [`as_slice()`][PacketLineRef::as_slice()] as [`BStr`].
1414 pub fn as_bstr(&self) -> Option<&BStr> {
1515 self.as_slice().map(Into::into)
1616 }
17− /// Interpret this instance's [`as_slice()`][PacketLine::as_slice()] as [`Error`].
17+ /// Interpret this instance's [`as_slice()`][PacketLineRef::as_slice()] as [`ErrorRef`].
1818 ///
1919 /// This works for any data received in an error [channel][crate::Channel].
2020 ///
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.
2323 pub fn as_error(&self) -> Option<ErrorRef<'_>> {
2424 self.as_slice().map(ErrorRef)
2525 }
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.
2727 ///
2828 /// This works for any data received in an error [channel][crate::Channel].
2929 pub fn check_error(&self) -> Option<ErrorRef<'_>> {
@@ -40,10 +40,10 @@ impl<'a> PacketLineRef<'a> { · 10 unmodified lines
4040 self.as_slice().map(Into::into)
4141 }
4242
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.
4444 ///
4545 /// 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.
4747 pub fn as_band(&self, kind: Channel) -> Option<BandRef<'_>> {
4848 self.as_slice().map(|d| match kind {
4949 Channel::Data => BandRef::Data(d),
@@ -52,7 +52,7 @@ impl<'a> PacketLineRef<'a> { · 2 unmodified lines
5252 })
5353 }
5454
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.
5656 pub fn decode_band(&self) -> Result<BandRef<'_>, decode::band::Error> {
5757 let d = self.as_slice().ok_or(decode::band::Error::NonDataLine)?;
5858 Ok(match d[0] {
git-packetline/src/read/mod.rs+1−1
@@ -10,7 +10,7 @@ type ExhaustiveOutcome<'a> = ( · 9 unmodified lines
1010 );
1111
1212 /// Read pack lines one after another, without consuming more than needed from the underlying
13−/// [`Read`][std::io::Read]. [`Flush`][PacketLine::Flush] lines cause the reader to stop producing lines forever,
13+/// [`Read`][std::io::Read]. [`Flush`][PacketLineRef::Flush] lines cause the reader to stop producing lines forever,
1414 /// leaving [`Read`][std::io::Read] at the start of whatever comes next.
1515 ///
1616 /// This implementation tries hard not to allocate at all which leads to quite some added complexity and plenty of extra memory copies.