Skip to content

Commit

Permalink
Merge pull request #131 from syvb/debug-pub-interfaces
Browse files Browse the repository at this point in the history
Implement Debug on all public structs
  • Loading branch information
Manishearth committed Feb 21, 2024
2 parents 8b894ca + 1f88570 commit 96dfef5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/grapheme.rs
Expand Up @@ -19,7 +19,7 @@ use crate::tables::grapheme::GraphemeCat;
///
/// [`grapheme_indices`]: trait.UnicodeSegmentation.html#tymethod.grapheme_indices
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct GraphemeIndices<'a> {
start_offset: usize,
iter: Graphemes<'a>,
Expand Down
12 changes: 6 additions & 6 deletions src/sentence.rs
Expand Up @@ -18,7 +18,7 @@ mod fwd {

// Describe a parsed part of source string as described in this table:
// https://unicode.org/reports/tr29/#Default_Sentence_Boundaries
#[derive(Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum StatePart {
Sot,
Eot,
Expand All @@ -33,7 +33,7 @@ mod fwd {
STerm,
}

#[derive(Clone, PartialEq, Eq)]
#[derive(Debug, Clone, PartialEq, Eq)]
struct SentenceBreaksState(pub [StatePart; 4]);

const INITIAL_STATE: SentenceBreaksState = SentenceBreaksState([
Expand All @@ -43,7 +43,7 @@ mod fwd {
StatePart::Sot,
]);

#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct SentenceBreaks<'a> {
pub string: &'a str,
pos: usize,
Expand Down Expand Up @@ -296,7 +296,7 @@ mod fwd {
///
/// [`unicode_sentences`]: trait.UnicodeSegmentation.html#tymethod.unicode_sentences
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct UnicodeSentences<'a> {
inner: Filter<USentenceBounds<'a>, fn(&&str) -> bool>,
}
Expand All @@ -309,7 +309,7 @@ pub struct UnicodeSentences<'a> {
///
/// [`split_sentence_bounds`]: trait.UnicodeSegmentation.html#tymethod.split_sentence_bounds
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct USentenceBounds<'a> {
iter: fwd::SentenceBreaks<'a>,
sentence_start: Option<usize>,
Expand All @@ -322,7 +322,7 @@ pub struct USentenceBounds<'a> {
///
/// [`split_sentence_bound_indices`]: trait.UnicodeSegmentation.html#tymethod.split_sentence_bound_indices
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct USentenceBoundIndices<'a> {
start_offset: usize,
iter: USentenceBounds<'a>,
Expand Down
6 changes: 4 additions & 2 deletions src/word.rs
Expand Up @@ -25,6 +25,7 @@ use crate::tables::word::WordCat;
///
/// [`unicode_words`]: trait.UnicodeSegmentation.html#tymethod.unicode_words
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Debug)]
pub struct UnicodeWords<'a> {
inner: Filter<UWordBounds<'a>, fn(&&str) -> bool>,
}
Expand Down Expand Up @@ -62,6 +63,7 @@ impl<'a> DoubleEndedIterator for UnicodeWords<'a> {
///
/// [`unicode_word_indices`]: trait.UnicodeSegmentation.html#tymethod.unicode_word_indices
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Debug)]
pub struct UnicodeWordIndices<'a> {
inner: Filter<UWordBoundIndices<'a>, fn(&(usize, &str)) -> bool>,
}
Expand Down Expand Up @@ -94,7 +96,7 @@ impl<'a> DoubleEndedIterator for UnicodeWordIndices<'a> {
///
/// [`split_word_bounds`]: trait.UnicodeSegmentation.html#tymethod.split_word_bounds
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct UWordBounds<'a> {
string: &'a str,
cat: Option<WordCat>,
Expand All @@ -108,7 +110,7 @@ pub struct UWordBounds<'a> {
///
/// [`split_word_bound_indices`]: trait.UnicodeSegmentation.html#tymethod.split_word_bound_indices
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct UWordBoundIndices<'a> {
start_offset: usize,
iter: UWordBounds<'a>,
Expand Down

0 comments on commit 96dfef5

Please sign in to comment.