2020-05-17 00:55:29 +01:00
#![ allow(clippy::all) ]
2020-05-11 00:48:18 +01:00
// This code was autogenerated with `dbus-codegen-rust --file telepathy-spec/spec/Channel_Handler.xml -i org.freedesktop.Telepathy -a AsRefClosure -o src/telepathy/channel_handler.rs`, see https://github.com/diwic/dbus-rs
2020-05-08 20:38:30 +01:00
use dbus ;
use dbus ::arg ;
use dbus ::tree ;
pub trait ChannelHandler {
fn handle_channel (
& self ,
bus_name : & str ,
connection : dbus ::Path ,
channel_type : & str ,
channel : dbus ::Path ,
handle_type : u32 ,
handle : u32 ,
) -> Result < ( ) , tree ::MethodErr > ;
}
pub fn channel_handler_server < F , T , D > (
factory : & tree ::Factory < tree ::MTFn < D > , D > ,
data : D ::Interface ,
f : F ,
) -> tree ::Interface < tree ::MTFn < D > , D >
where
D : tree ::DataType ,
D ::Method : Default ,
2020-05-11 00:48:18 +01:00
T : AsRef < dyn ChannelHandler > ,
F : 'static + Fn ( & tree ::MethodInfo < tree ::MTFn < D > , D > ) -> T ,
2020-05-08 20:38:30 +01:00
{
let i = factory . interface ( " org.freedesktop.Telepathy.ChannelHandler " , data ) ;
let f = ::std ::sync ::Arc ::new ( f ) ;
let fclone = f . clone ( ) ;
let h = move | minfo : & tree ::MethodInfo < tree ::MTFn < D > , D > | {
let mut i = minfo . msg . iter_init ( ) ;
let bus_name : & str = i . read ( ) ? ;
let connection : dbus ::Path = i . read ( ) ? ;
let channel_type : & str = i . read ( ) ? ;
let channel : dbus ::Path = i . read ( ) ? ;
let handle_type : u32 = i . read ( ) ? ;
let handle : u32 = i . read ( ) ? ;
2020-05-11 00:48:18 +01:00
let dd = fclone ( minfo ) ;
let d = dd . as_ref ( ) ;
2020-05-08 20:38:30 +01:00
d . handle_channel (
bus_name ,
connection ,
channel_type ,
channel ,
handle_type ,
handle ,
) ? ;
let rm = minfo . msg . method_return ( ) ;
Ok ( vec! [ rm ] )
} ;
let m = factory . method ( " HandleChannel " , Default ::default ( ) , h ) ;
let m = m . in_arg ( ( " Bus_Name " , " s " ) ) ;
let m = m . in_arg ( ( " Connection " , " o " ) ) ;
let m = m . in_arg ( ( " Channel_Type " , " s " ) ) ;
let m = m . in_arg ( ( " Channel " , " o " ) ) ;
let m = m . in_arg ( ( " Handle_Type " , " u " ) ) ;
let m = m . in_arg ( ( " Handle " , " u " ) ) ;
let i = i . add_m ( m ) ;
i
}