mcfunction_debugger/
utils.rs

1// Mcfunction-Debugger is a debugger for Minecraft's *.mcfunction files that does not require any
2// Minecraft mods.
3//
4// © Copyright (C) 2021-2024 Adrodoc <adrodoc55@googlemail.com> & Skagaros <skagaros@gmail.com>
5//
6// This file is part of Mcfunction-Debugger.
7//
8// Mcfunction-Debugger is free software: you can redistribute it and/or modify it under the terms of
9// the GNU General Public License as published by the Free Software Foundation, either version 3 of
10// the License, or (at your option) any later version.
11//
12// Mcfunction-Debugger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License along with Mcfunction-Debugger.
17// If not, see <http://www.gnu.org/licenses/>.
18
19pub trait Map0<T0, R0> {
20    type Output;
21
22    fn map0<F: Fn(T0) -> R0>(self, map: F) -> Self::Output;
23}
24
25impl<T0, T1, R0> Map0<T0, R0> for (T0, T1) {
26    type Output = (R0, T1);
27
28    fn map0<F: Fn(T0) -> R0>(self, map: F) -> Self::Output {
29        (map(self.0), self.1)
30    }
31}