Skip to content

Commit 6efa709

Browse files
committed
fix: Into<From> for Eligibility
1 parent cb12a5d commit 6efa709

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/platform/bundle.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,23 +157,25 @@ impl Eligibility {
157157
None
158158
}
159159
}
160+
}
160161

162+
impl Into<bool> for Eligibility {
161163
/// This is a quality of life helper that allows users of this api to say:
162-
/// `if bundle.is_eligible(block).as_bool() { .. }`, without going into the
164+
/// `if bundle.is_eligible(block).into() {.}`, without going into the
163165
/// details of the eligibility.
164-
pub fn as_bool(self) -> bool {
166+
fn into(self) -> bool {
165167
matches!(self, Eligibility::Eligible)
166168
}
167169
}
168170

169171
/// This is a quality of life helper that allows users of this api to say:
170-
/// `if !bundle.is_eligible(block) { .. }`, without going into the details of
172+
/// `if !bundle.is_eligible(block) {.}`, without going into the details of
171173
/// the ineligibility.
172174
impl Not for Eligibility {
173175
type Output = bool;
174176

175177
fn not(self) -> Self::Output {
176-
!self.as_bool()
178+
!<Eligibility as Into<bool>>::into(self)
177179
}
178180
}
179181

0 commit comments

Comments
 (0)