Skip to content

Commit 1f88570

Browse files
committed
Implement Debug on all public structs
Some types in this crate don't have Debug implemented, but it's annoying to use a non-Debug type in a struct with Debug derived. I just used the automatic impl from `#[derive(Debug)]` for all of these (although in the future it might be good to have custom implementations for types with complex internals). Closes #95.
1 parent 184277a commit 1f88570

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/grapheme.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::tables::grapheme::GraphemeCat;
1919
///
2020
/// [`grapheme_indices`]: trait.UnicodeSegmentation.html#tymethod.grapheme_indices
2121
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
22-
#[derive(Clone)]
22+
#[derive(Debug, Clone)]
2323
pub struct GraphemeIndices<'a> {
2424
start_offset: usize,
2525
iter: Graphemes<'a>,

src/sentence.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ mod fwd {
1818

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

36-
#[derive(Clone, PartialEq, Eq)]
36+
#[derive(Debug, Clone, PartialEq, Eq)]
3737
struct SentenceBreaksState(pub [StatePart; 4]);
3838

3939
const INITIAL_STATE: SentenceBreaksState = SentenceBreaksState([
@@ -43,7 +43,7 @@ mod fwd {
4343
StatePart::Sot,
4444
]);
4545

46-
#[derive(Clone)]
46+
#[derive(Debug, Clone)]
4747
pub struct SentenceBreaks<'a> {
4848
pub string: &'a str,
4949
pos: usize,
@@ -296,7 +296,7 @@ mod fwd {
296296
///
297297
/// [`unicode_sentences`]: trait.UnicodeSegmentation.html#tymethod.unicode_sentences
298298
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
299-
#[derive(Clone)]
299+
#[derive(Debug, Clone)]
300300
pub struct UnicodeSentences<'a> {
301301
inner: Filter<USentenceBounds<'a>, fn(&&str) -> bool>,
302302
}
@@ -309,7 +309,7 @@ pub struct UnicodeSentences<'a> {
309309
///
310310
/// [`split_sentence_bounds`]: trait.UnicodeSegmentation.html#tymethod.split_sentence_bounds
311311
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
312-
#[derive(Clone)]
312+
#[derive(Debug, Clone)]
313313
pub struct USentenceBounds<'a> {
314314
iter: fwd::SentenceBreaks<'a>,
315315
sentence_start: Option<usize>,
@@ -322,7 +322,7 @@ pub struct USentenceBounds<'a> {
322322
///
323323
/// [`split_sentence_bound_indices`]: trait.UnicodeSegmentation.html#tymethod.split_sentence_bound_indices
324324
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
325-
#[derive(Clone)]
325+
#[derive(Debug, Clone)]
326326
pub struct USentenceBoundIndices<'a> {
327327
start_offset: usize,
328328
iter: USentenceBounds<'a>,

src/word.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use crate::tables::word::WordCat;
2525
///
2626
/// [`unicode_words`]: trait.UnicodeSegmentation.html#tymethod.unicode_words
2727
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
28+
#[derive(Debug)]
2829
pub struct UnicodeWords<'a> {
2930
inner: Filter<UWordBounds<'a>, fn(&&str) -> bool>,
3031
}
@@ -62,6 +63,7 @@ impl<'a> DoubleEndedIterator for UnicodeWords<'a> {
6263
///
6364
/// [`unicode_word_indices`]: trait.UnicodeSegmentation.html#tymethod.unicode_word_indices
6465
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
66+
#[derive(Debug)]
6567
pub struct UnicodeWordIndices<'a> {
6668
inner: Filter<UWordBoundIndices<'a>, fn(&(usize, &str)) -> bool>,
6769
}
@@ -94,7 +96,7 @@ impl<'a> DoubleEndedIterator for UnicodeWordIndices<'a> {
9496
///
9597
/// [`split_word_bounds`]: trait.UnicodeSegmentation.html#tymethod.split_word_bounds
9698
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
97-
#[derive(Clone)]
99+
#[derive(Debug, Clone)]
98100
pub struct UWordBounds<'a> {
99101
string: &'a str,
100102
cat: Option<WordCat>,
@@ -108,7 +110,7 @@ pub struct UWordBounds<'a> {
108110
///
109111
/// [`split_word_bound_indices`]: trait.UnicodeSegmentation.html#tymethod.split_word_bound_indices
110112
/// [`UnicodeSegmentation`]: trait.UnicodeSegmentation.html
111-
#[derive(Clone)]
113+
#[derive(Debug, Clone)]
112114
pub struct UWordBoundIndices<'a> {
113115
start_offset: usize,
114116
iter: UWordBounds<'a>,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy