1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
// Copyright (c) SimpleStaking and Tezedge Contributors // SPDX-License-Identifier: MIT use crate::value::OCaml; use crate::conv::FromOCaml; /// Counterpart to `FromOCaml`, usually more comfortable to use. pub trait IntoRust<T>: Sized { /// Convert into a Rust value. fn into_rust(self) -> T; } impl<'a, T, U> IntoRust<U> for OCaml<'a, T> where U: FromOCaml<T>, { fn into_rust(self) -> U { U::from_ocaml(self) } }