Skip to content

Commit

Permalink
Improve wording
Browse files Browse the repository at this point in the history
  • Loading branch information
laurmaedje committed Apr 17, 2022
1 parent c943791 commit 168fa7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Painless string scanning.
unscanny = "0.1"
```

Basically, you want to use this if right now you're manually dealing with a
`chars()` iterator but it's too much pain. More broadly speaking, it's
useful in the following two situations:
Basically, you'll want to use this crate if it's too much pain to solve your
problem with a bare `chars()` iterator. Speaking more broadly, `unscanny` is
useful in these situations:
- You need to parse simple flat grammars (dates, times, custom stuff, ...) and
want an interface that's a bit more convenient to use than a simple char
iterator.
Expand Down Expand Up @@ -41,7 +41,7 @@ assert_eq!(nums, [12.0, -15.3, 14.3]);
```

## Safety
This crate uses unsafe code internally for better performance. However, all
This crate internally uses unsafe code for better performance. However, all
unsafe code is documented with justification why its safe, all accesses are
checked in debug mode and everything is tested.

Expand Down
15 changes: 7 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*!
Painless string scanning.
Basically, you want to use this if right now you're manually dealing with a
`chars()` iterator but it's too much pain. More broadly speaking, it's
useful in the following two situations:
Basically, you'll want to use this crate if it's too much pain to solve your
problem with a bare `chars()` iterator. Speaking more broadly, `unscanny` is
useful in these situations:
- You need to parse simple flat grammars (dates, times, custom stuff, ...) and
want an interface that's a bit more convenient to use than a simple char
iterator.
Expand Down Expand Up @@ -75,7 +75,7 @@ impl<'a> Scanner<'a> {
self.cursor
}

/// Whether the cursor is at the end of the string.
/// Whether the scanner has fully consumed the string.
#[inline]
pub fn done(&self) -> bool {
self.cursor == self.string.len()
Expand Down Expand Up @@ -352,10 +352,9 @@ impl Debug for Scanner<'_> {
///
/// As you might have noticed, this closely mirrors the
/// [`Pattern`](std::str::pattern::Pattern) trait from the standard library.
/// This trait is unfortunately unstable though, so we can't use it in the
/// scanner's method signatures. Furthermore, it doesn't support passing `&char`
/// functions which is quite useful because some char methods take `self` by
/// reference.
/// Unfortunately, this trait is unstable, so we can't use it in the scanner's
/// method signatures. Furthermore, it doesn't support passing `&char` functions
/// which is quite useful because some char methods take `self` by reference.
pub trait Pattern<T>: Sealed<T> {}

use sealed::Sealed;
Expand Down

0 comments on commit 168fa7a

Please sign in to comment.