Implement DigestVerify for Tuples

This commit is contained in:
asonix 2020-01-17 16:59:42 -06:00
parent a2bc8c03ee
commit 51bd0ad1ef

View file

@ -105,6 +105,39 @@ where
}
}
impl<T, U> DigestVerify for (T, U)
where
T: DigestVerify,
U: DigestVerify,
{
fn verify(&mut self, parts: &[DigestPart], payload: &[u8]) -> bool {
self.0.verify(parts, payload) || self.1.verify(parts, payload)
}
}
impl<T, U, V> DigestVerify for (T, U, V)
where
T: DigestVerify,
U: DigestVerify,
V: DigestVerify,
{
fn verify(&mut self, parts: &[DigestPart], payload: &[u8]) -> bool {
self.0.verify(parts, payload) || self.1.verify(parts, payload) || self.2.verify(parts, payload)
}
}
impl<T, U, V, W> DigestVerify for (T, U, V, W)
where
T: DigestVerify,
U: DigestVerify,
V: DigestVerify,
W: DigestVerify,
{
fn verify(&mut self, parts: &[DigestPart], payload: &[u8]) -> bool {
self.0.verify(parts, payload) || self.1.verify(parts, payload) || self.2.verify(parts, payload) || self.3.verify(parts, payload)
}
}
impl FromStr for DigestPart {
type Err = ParseDigestError;