StaticPairAtomic for pair
All checks were successful
buildbot/runtests Build done.

This commit is contained in:
AF 2023-08-04 23:53:43 +00:00
parent 25ae91f0d2
commit 2fb9fe9e86

View File

@ -3,6 +3,7 @@
use std::error::Error; use std::error::Error;
use std::fmt::Display; use std::fmt::Display;
use crate::atomic::*;
use crate::mode::*; use crate::mode::*;
use crate::rcore::*; use crate::rcore::*;
use crate::rstd::inlining::static_pair::*; use crate::rstd::inlining::static_pair::*;
@ -87,3 +88,22 @@ where
(self.0.factory(), self.1.factory()) (self.0.factory(), self.1.factory())
} }
} }
impl<A: AtomicBase + ParseMode, B: AtomicBase + ParseMode> StaticPairAtomic for (A, B) {
type A = A;
type B = B;
type AParseError = PairParseError<A::AParseError, B::AParseError>;
fn from_parsed(a: Self::A, b: Self::B) -> Result<Self, Self::AParseError> {
Ok((a, b))
}
fn from_error_a(error: AParseError<Self::A>) -> Self::AParseError {
PairParseError::A(error)
}
fn from_error_b(error: AParseError<Self::B>) -> Self::AParseError {
PairParseError::B(error)
}
}