luaur_analysis/records/
try_pair.rs1#[allow(non_camel_case_types)]
2#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
3pub struct TryPair<A, B> {
4 pub first: A,
5 pub second: B,
6}
7
8impl<A, B> TryPair<A, B>
9where
10 A: Copy + Into<bool>,
11 B: Copy + Into<bool>,
12{
13 pub fn as_bool(&self) -> bool {
14 self.first.into() && self.second.into()
15 }
16}
17
18impl<A, B> From<TryPair<A, B>> for bool
19where
20 A: Into<bool>,
21 B: Into<bool>,
22{
23 fn from(pair: TryPair<A, B>) -> bool {
24 pair.first.into() && pair.second.into()
25 }
26}