1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use super::{InputType, ReturnType, ToForeign};

pub struct UnitMarshaler;

impl InputType for UnitMarshaler {
    type Foreign = ();
    type ForeignTraitObject = ();
}

impl ReturnType for UnitMarshaler {
    type Foreign = ();
    type ForeignTraitObject = ();

    #[inline(always)]
    fn foreign_default() -> () {
        ()
    }
}

impl<E> ToForeign<Result<(), E>, ()> for UnitMarshaler {
    type Error = E;

    #[inline(always)]
    fn to_foreign(local: Result<(), E>) -> Result<(), Self::Error> {
        local
    }
}