Skip to content

Commit

Permalink
Fix typos and add more links (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam authored Oct 10, 2024
1 parent 6d72556 commit c00411f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub trait EmptyBuilder {
/// Creates a new empty octets builder with a suggested initial size.
///
/// The builder may or may not use the size provided by `capacity` as the
/// initial size of the buffer. It may very well be possibly that the
/// initial size of the buffer. It may very well be possible that the
/// builder is never able to grow to this capacity at all. Therefore,
/// even if you create a builder for your data size via this function,
/// appending may still fail.
Expand Down Expand Up @@ -275,12 +275,12 @@ impl<const N: usize> EmptyBuilder for heapless::Vec<u8, N> {

//------------ FreezeBuilder -------------------------------------------------

/// An octets builder that can be frozen into a imutable octets sequence.
/// An octets builder that can be frozen into a immutable octets sequence.
pub trait FreezeBuilder {
/// The type of octets sequence to builder will be frozen into.
type Octets;

/// Converts the octets builder into an imutable octets sequence.
/// Converts the octets builder into an immutable octets sequence.
fn freeze(self) -> Self::Octets;
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This crate provides a set of basic traits that allow defining types that
//! are generic over a variable length sequence of octets (or, vulgo: bytes).
//!
//! There are two groups of traits: those that represent behavior of imutable
//! There are two groups of traits: those that represent behavior of immutable
//! octets sequences are collected in the module _[octets]_ and those for
//! building such sequences are in _[builder]_. Most traits from these modules
//! are also re-exported at the crate root for convenience.
Expand All @@ -23,7 +23,7 @@
//!
//! * The _[mod@array]_ module provides an octets builder backed by an octets
//! array.
//! * The _[mod@str]_ module provides both imutable and buildable string types
//! * The _[mod@str]_ module provides both immutable and buildable string types
//! that are generic over the octets sequence they wrap.
//! * The
#![cfg_attr(feature = "serde", doc = " _[serde]_")]
Expand Down
16 changes: 3 additions & 13 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ use crate::octets::Octets;

/// A parser for sequentially extracting data from an octets sequence.
///
/// The parser wraps an [octets reference] and remembers the read position on
/// The parser wraps an [Octets] reference and remembers the read position on
/// the referenced sequence. Methods allow reading out data and progressing
/// the position beyond processed data.
///
/// [octets reference]: trait.OctetsRef.html
#[derive(Debug)]
pub struct Parser<'a, Octs: ?Sized> {
/// The underlying octets reference.
Expand All @@ -26,10 +24,6 @@ pub struct Parser<'a, Octs: ?Sized> {
pos: usize,

/// The length of the octets sequence.
///
/// This starts out as the length of the underlying sequence and is kept
/// here to be able to temporarily limit the allowed length for
/// `parse_blocks`.
len: usize,
}

Expand Down Expand Up @@ -136,9 +130,7 @@ impl<'a, Octs: ?Sized> Parser<'a, Octs> {
/// Returns the length of the underlying octet sequence.
///
/// This is _not_ the number of octets left for parsing. Use
/// [`remaining`] for that.
///
/// [`remaining`]: #method.remaining
/// [`Parser::remaining`] for that.
pub fn len(&self) -> usize {
self.len
}
Expand All @@ -164,9 +156,7 @@ impl<'a, Octs: AsRef<[u8]> + ?Sized> Parser<'a, Octs> {
/// Returns an octets slice of the underlying sequence.
///
/// The slice covers the entire sequence, not just the remaining data. You
/// can use [`peek`] for that.
///
/// [`peek`]: #method.peek
/// can use [`Parser::peek`] for that.
pub fn as_slice(&self) -> &[u8] {
&self.octets.as_ref()[..self.len]
}
Expand Down
8 changes: 4 additions & 4 deletions src/str.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Strings atop octet sequences.
//!
//! This module provides the type `Str<Octets>` that guarantees the same
//! This module provides the type [`Str<Octets>`] that guarantees the same
//! invariants – namely that the content is an UTF-8 encoded string – as
//! the standard library’s `str` and `String` types but atop a generic
//! the standard library’s [`str`] and [`String`] types but atop a generic
//! octet sequence.
use core::{borrow, cmp, fmt, hash, ops, str};
Expand Down Expand Up @@ -42,7 +42,7 @@ impl<Octets> Str<Octets> {
Self(octets)
}

/// Creates a value by copying the content of a `str`.
/// Creates a value by copying the content of a [`str`].
pub fn try_copy_from_str(
s: &str
) -> Result<Self, BuilderAppendError<Octets>>
Expand All @@ -55,7 +55,7 @@ impl<Octets> Str<Octets> {
Ok(unsafe { Self::from_utf8_unchecked(res.freeze()) })
}

/// Creates a value by copying the content of a `str`.
/// Creates a value by copying the content of a [`str`].
///
/// This function is identical to
/// [`try_copy_from_str`][Self::try_copy_from_str] for octets types
Expand Down

0 comments on commit c00411f

Please sign in to comment.