summaryrefslogtreecommitdiff
path: root/src/csets.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2023-07-30 19:58:41 -0400
committerBotahamec <botahamec@outlook.com>2023-07-30 19:58:41 -0400
commitfb66891fbac0daed8e85f8c4e2fc598baa112d18 (patch)
treec0a6e348a91612ca041ee10a419e765b22d93be7 /src/csets.rs
parent6261e57f55efd0c10d3011f306dccbf5ca787003 (diff)
Move Sized requirement for CharacterSet trait
Diffstat (limited to 'src/csets.rs')
-rw-r--r--src/csets.rs22
1 files changed, 17 insertions, 5 deletions
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<Other: CharacterSet>(self, other: Other) -> CharacterSetUnion<Self, Other> {
+ fn union<Other: CharacterSet>(self, other: Other) -> CharacterSetUnion<Self, Other>
+ where
+ Self: Sized,
+ {
CharacterSetUnion {
first: self,
second: other,
@@ -13,21 +16,30 @@ pub trait CharacterSet: Sized {
fn intersection<Other: CharacterSet>(
self,
other: Other,
- ) -> CharacterSetIntersection<Self, Other> {
+ ) -> CharacterSetIntersection<Self, Other>
+ where
+ Self: Sized,
+ {
CharacterSetIntersection {
first: self,
second: other,
}
}
- fn difference<Other: CharacterSet>(self, other: Other) -> CharacterSetDifference<Self, Other> {
+ fn difference<Other: CharacterSet>(self, other: Other) -> CharacterSetDifference<Self, Other>
+ where
+ Self: Sized,
+ {
CharacterSetDifference {
first: self,
second: other,
}
}
- fn complement(self) -> CharacterSetComplement<Self> {
+ fn complement(self) -> CharacterSetComplement<Self>
+ where
+ Self: Sized,
+ {
CharacterSetComplement { inner: self }
}
}