From fb66891fbac0daed8e85f8c4e2fc598baa112d18 Mon Sep 17 00:00:00 2001 From: Botahamec Date: Sun, 30 Jul 2023 19:58:41 -0400 Subject: Move Sized requirement for CharacterSet trait --- src/csets.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/csets.rs b/src/csets.rs index f8f58a9..bc739b2 100644 --- a/src/csets.rs +++ b/src/csets.rs @@ -1,9 +1,12 @@ use std::collections::HashSet; -pub trait CharacterSet: Sized { +pub trait CharacterSet { fn contains(&self, ch: char) -> bool; - fn union(self, other: Other) -> CharacterSetUnion { + fn union(self, other: Other) -> CharacterSetUnion + where + Self: Sized, + { CharacterSetUnion { first: self, second: other, @@ -13,21 +16,30 @@ pub trait CharacterSet: Sized { fn intersection( self, other: Other, - ) -> CharacterSetIntersection { + ) -> CharacterSetIntersection + where + Self: Sized, + { CharacterSetIntersection { first: self, second: other, } } - fn difference(self, other: Other) -> CharacterSetDifference { + fn difference(self, other: Other) -> CharacterSetDifference + where + Self: Sized, + { CharacterSetDifference { first: self, second: other, } } - fn complement(self) -> CharacterSetComplement { + fn complement(self) -> CharacterSetComplement + where + Self: Sized, + { CharacterSetComplement { inner: self } } } -- cgit v1.2.3