diff --git a/src/explicit.rs b/src/explicit.rs index d840a7a..d4ad897 100644 --- a/src/explicit.rs +++ b/src/explicit.rs @@ -31,9 +31,7 @@ pub fn compute<'a, T: TextSource<'a> + ?Sized>( original_classes: &[BidiClass], levels: &mut [Level], processing_classes: &mut [BidiClass], -) where - >::IndexLenIter: Iterator, -{ +) { assert_eq!(text.len(), original_classes.len()); // diff --git a/src/implicit.rs b/src/implicit.rs index 2265f7a..0311053 100644 --- a/src/implicit.rs +++ b/src/implicit.rs @@ -255,10 +255,7 @@ pub fn resolve_neutral<'a, D: BidiDataSource, T: TextSource<'a> + ?Sized>( levels: &[Level], original_classes: &[BidiClass], processing_classes: &mut [BidiClass], -) where - >::CharIndexIter: Iterator, - >::CharIter: Iterator, -{ +) { // e = embedding direction let e: BidiClass = levels[sequence.runs[0].start].bidi_class(); let not_e = if e == BidiClass::L { @@ -487,10 +484,7 @@ fn identify_bracket_pairs<'a, T: TextSource<'a> + ?Sized, D: BidiDataSource>( data_source: &D, run_sequence: &IsolatingRunSequence, original_classes: &[BidiClass], -) -> Vec -where - >::CharIndexIter: Iterator, -{ +) -> Vec { let mut ret = vec![]; let mut stack = vec![]; diff --git a/src/lib.rs b/src/lib.rs index 9d65c2e..8e61f27 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,7 +107,12 @@ use crate::BidiClass::*; /// We implement this for str (UTF-8) and for [u16] (UTF-16, native-endian). /// (For internal unicode-bidi use; API may be unstable.) /// This trait is sealed and cannot be implemented for types outside this crate. -pub trait TextSource<'text>: private::Sealed { +pub trait TextSource<'text>: private::Sealed +where + >::CharIndexIter: Iterator, + >::CharIter: Iterator, + >::IndexLenIter: Iterator, +{ type CharIter; type CharIndexIter; type IndexLenIter; @@ -283,10 +288,7 @@ fn compute_initial_info<'a, D: BidiDataSource, T: TextSource<'a> + ?Sized>( data_source: &D, text: &'a T, default_para_level: Option, -) -> (Vec, Vec, Vec) -where - >::CharIndexIter: Iterator, -{ +) -> (Vec, Vec, Vec) { let mut original_classes = Vec::with_capacity(text.len()); // The stack contains the starting code unit index for each nested isolate we're inside. @@ -835,11 +837,7 @@ fn compute_bidi_info_for_para<'a, D: BidiDataSource, T: TextSource<'a> + ?Sized> original_classes: &[BidiClass], processing_classes: &mut [BidiClass], levels: &mut Vec, -) where - >::CharIndexIter: Iterator, - >::CharIter: Iterator, - >::IndexLenIter: Iterator, -{ +) { let new_len = levels.len() + para.range.len(); levels.resize(new_len, para.level); if para.level == LTR_LEVEL && is_pure_ltr { @@ -886,9 +884,7 @@ fn reorder_levels<'a, T: TextSource<'a> + ?Sized>( line_levels: &mut [Level], line_text: &'a T, para_level: Level, -) where - >::CharIndexIter: Iterator, -{ +) { // Reset some whitespace chars to paragraph level. // let mut reset_from: Option = Some(0);