1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use std::collections::HashMap;

pub trait Extendable {
    type Output;

    unsafe fn set_arguments(self, arguments: HashMap<String, String>) -> Self::Output;
}

macro_rules! extendable {
    ($($t:ty), +) => (
        $(impl Extendable for $t {
            type Output = $t;

            unsafe fn set_arguments(mut self, arguments: HashMap<String, String>) -> Self::Output {
                self.arguments = arguments;
                self
            }
        })+
    )
}