From 2fb9fe9e86b1746f2cd13c30de5bbd02e618aa4a Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 4 Aug 2023 23:53:43 +0000 Subject: [PATCH] `StaticPairAtomic` for pair --- src/rstd/collections/pair.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/rstd/collections/pair.rs b/src/rstd/collections/pair.rs index 2607369..01aee33 100644 --- a/src/rstd/collections/pair.rs +++ b/src/rstd/collections/pair.rs @@ -3,6 +3,7 @@ use std::error::Error; use std::fmt::Display; +use crate::atomic::*; use crate::mode::*; use crate::rcore::*; use crate::rstd::inlining::static_pair::*; @@ -87,3 +88,22 @@ where (self.0.factory(), self.1.factory()) } } + +impl StaticPairAtomic for (A, B) { + type A = A; + type B = B; + + type AParseError = PairParseError; + + fn from_parsed(a: Self::A, b: Self::B) -> Result { + Ok((a, b)) + } + + fn from_error_a(error: AParseError) -> Self::AParseError { + PairParseError::A(error) + } + + fn from_error_b(error: AParseError) -> Self::AParseError { + PairParseError::B(error) + } +}