pub fn from_channel<C: From<Channel> + NonblockReply>(
    channel: Channel
) -> Result<(IOResource<C>, Arc<C>), Error>
Expand description

Create a connection from channel, you may need to invoke channel.register()? to make sure the channel is usable.

Example

use std::sync::Arc;

use dbus::channel::Channel;
use dbus_tokio::connection;
use dbus_tokio::connection::IOResource;
use dbus::nonblock::SyncConnection;

let mut channel = Channel::open_private("unix:path=/run/user/1000/bus").expect("open private channel failed");

channel.register().expect("register channel failed");

let (resource, conn): (IOResource<SyncConnection>, Arc<SyncConnection>) = connection::from_channel(channel).expect("create connection failed");

tokio::spawn(resource);

// do anything with the conn