multiversx_chain_scenario_format/
reconstruct_trait.rs

1#[derive(Default)]
2pub struct ReconstructorContext {}
3
4impl ReconstructorContext {
5    pub fn new() -> Self {
6        ReconstructorContext {}
7    }
8}
9
10pub trait ReconstructableFrom<T> {
11    fn reconstruct_from(from: T, builder: &ReconstructorContext) -> Self;
12}
13
14impl<T> ReconstructableFrom<T> for T {
15    fn reconstruct_from(from: T, _builder: &ReconstructorContext) -> Self {
16        from
17    }
18}
19
20impl<T: Clone> ReconstructableFrom<&T> for T {
21    fn reconstruct_from(from: &T, _builder: &ReconstructorContext) -> Self {
22        from.clone()
23    }
24}
25
26pub trait IntoRaw<R> {
27    fn into_raw(self) -> R;
28}