From d61c0b0973597ab44dc1437df4e93d068f631bd8 Mon Sep 17 00:00:00 2001 From: Wassim Badraoui <98709649+Wassbdr@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:44:31 +0200 Subject: [PATCH] Update mod.rs adapt the trait to support 16 args --- src/row/convert/mod.rs | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/src/row/convert/mod.rs b/src/row/convert/mod.rs index 4aaa2e0..ba2079d 100644 --- a/src/row/convert/mod.rs +++ b/src/row/convert/mod.rs @@ -838,6 +838,81 @@ where ir12.into(), )) } + +} +impl FromRow for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) +where + T1: FromValue, + T2: FromValue, + T3: FromValue, + T4: FromValue, + T5: FromValue, + T6: FromValue, + T7: FromValue, + T8: FromValue, + T9: FromValue, + T10: FromValue, + T11: FromValue, + T12: FromValue, + T13: FromValue, + T14: FromValue, + T15: FromValue, + T16: FromValue, + T1::Intermediate: Into, + T2::Intermediate: Into, + T3::Intermediate: Into, + T4::Intermediate: Into, + T5::Intermediate: Into, + T6::Intermediate: Into, + T7::Intermediate: Into, + T8::Intermediate: Into, + T9::Intermediate: Into, + T10::Intermediate: Into, + T11::Intermediate: Into, + T12::Intermediate: Into, + T13::Intermediate: Into, + T14::Intermediate: Into, + T15::Intermediate: Into, +{ + fn from_row_opt(mut row: Row) -> Result<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16), FromRowError> { + if row.len() != 16 { + return Err(FromRowError(row)); + } + let ir1 = take_or_place!(row, 0, T1); + let ir2 = take_or_place!(row, 1, T2, [0, ir1]); + let ir3 = take_or_place!(row, 2, T3, [0, ir1], [1, ir2]); + let ir4 = take_or_place!(row, 3, T4, [0, ir1], [1, ir2], [2, ir3]); + let ir5 = take_or_place!(row, 4, T5, [0, ir1], [1, ir2], [2, ir3], [3, ir4]); + let ir6 = take_or_place!(row, 5, T6, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5]); + let ir7 = take_or_place!(row, 6, T7, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6]); + let ir8 = take_or_place!(row, 7, T8, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7]); + let ir9 = take_or_place!(row, 8, T9, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8]); + let ir10 = take_or_place!(row, 9, T10, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8], [8, ir9]); + let ir11 = take_or_place!(row, 10, T11, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8], [8, ir9], [9, ir10]); + let ir12 = take_or_place!(row, 11, T12, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8], [8, ir9], [9, ir10], [10, ir11]); + let ir13 = take_or_place!(row, 12, T13, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8], [8, ir9], [9, ir10], [10, ir11], [11, ir12]); + let ir14 = take_or_place!(row, 13, T14, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8], [8, ir9], [9, ir10], [10, ir11], [11, ir12], [12, ir13]); + let ir15 = take_or_place!(row, 14, T15, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8], [8, ir9], [9, ir10], [10, ir11], [11, ir12], [12, ir13], [13, ir14]); + let ir16 = take_or_place!(row, 15, T16, [0, ir1], [1, ir2], [2, ir3], [3, ir4], [4, ir5], [5, ir6], [6, ir7], [7, ir8], [8, ir9], [9, ir10], [10, ir11], [11, ir12], [12, ir13], [13, ir14], [14, ir15]); + Ok(( + Into::::into(ir1), + Into::::into(ir2), + Into::::into(ir3), + Into::::into(ir4), + Into::::into(ir5), + Into::::into(ir6), + Into::::into(ir7), + Into::::into(ir8), + Into::::into(ir9), + Into::::into(ir10), + Into::::into(ir11), + Into::::into(ir12), + Into::::into(ir13), + Into::::into(ir14), + Into::::into(ir15), + ir16.into(), + )) + } } #[cfg(feature = "nightly")]