pub fn request_name(&self, name: &str, flags: RequestNameFlags)
                        -> Result<RequestNameReply> {
        // TODO: Use an actual struct with an API for this.
        let msg = Message::new_method_call("org.freedesktop.DBus",
                                           "/org/freedesktop/DBus",
                                           "org.freedesktop.DBus",
                                           "RequestName")
            .add_argument(&name)
            .add_argument(&flags.bits);
        if let Some(mut results) = self.conn.call_sync(msg.message)? {
            if let Some(Value::BasicValue(BasicValue::Uint32(r))) = results.pop() {
                match r {
                    1 => Ok(RequestNameReply::PrimaryOwner),
                    2 => Ok(RequestNameReply::InQueue),
                    3 => Ok(RequestNameReply::Exists),
                    4 => Ok(RequestNameReply::AlreadyOwner),
                    _ => bail!(ErrorKind::InvalidReply(format!("RequestName: invalid response {}", r))),
                }
            } else {
                bail!(ErrorKind::InvalidReply("RequestName: invalid response".to_string()));
            }
        } else {
            bail!(ErrorKind::InvalidReply("RequestName: no response".to_string()));
        }
    }
/// Request a name on the bus.
///
/// By default, the name to address this connection directly is assigned by the daemon managing
/// the bus, but a name for the application may be requested. Names are, by convention, in a
/// reverse domain name format and use CamelCase for application-level names (e.g.,
/// `com.example.Application`).
Request a name on the bus.
By default, the name to address this connection directly is assigned by the daemon managing
the bus, but a name for the application may be requested. Names are, by convention, in a
reverse domain name format and use CamelCase for application-level names .
Request a name on the bus . By default the name to address this connection directly is assigned by the daemon managing the bus but a name for the application may be requested . Names are by convention in a reverse domain name format and use CamelCase for application - level names .
pub fn request_name(&self, name: &str, flags: RequestNameFlags)
                        -> Result<RequestNameReply> {
        // TODO: Use an actual struct with an API for this.
        let msg = Message::new_method_call("org.freedesktop.DBus",
                                           "/org/freedesktop/DBus",
                                           "org.freedesktop.DBus",
                                           "RequestName")
            .add_argument(&name)
            .add_argument(&flags.bits);
        if let Some(mut results) = self.conn.call_sync(msg.message)? {
            if let Some(Value::BasicValue(BasicValue::Uint32(r))) = results.pop() {
                match r {
                    1 => Ok(RequestNameReply::PrimaryOwner),
                    2 => Ok(RequestNameReply::InQueue),
                    3 => Ok(RequestNameReply::Exists),
                    4 => Ok(RequestNameReply::AlreadyOwner),
                    _ => bail!(ErrorKind::InvalidReply(format!("RequestName: invalid response {}", r))),
                }
            } else {
                bail!(ErrorKind::InvalidReply("RequestName: invalid response".to_string()));
            }
        } else {
            bail!(ErrorKind::InvalidReply("RequestName: no response".to_string()));
        }
    }
pub fn request_name ( & self , name : & str , flags : RequestNameFlags ) -> Result < RequestNameReply > { // TODO: Use an actual struct with an API for this. let msg = Message :: new_method_call ( " " , " " , " " , " " ) . add_argument ( & name ) . add_argument ( & flags . bits ) ; if let Some ( mut results ) = self . conn . call_sync ( msg . message ) ? { if let Some ( Value :: BasicValue ( BasicValue :: Uint32 ( r ) ) ) = results . pop ( ) { match r { 1 => Ok ( RequestNameReply :: PrimaryOwner ) , 2 => Ok ( RequestNameReply :: InQueue ) , 3 => Ok ( RequestNameReply :: Exists ) , 4 => Ok ( RequestNameReply :: AlreadyOwner ) , _ => bail ! ( ErrorKind InvalidReply ( format ( " " r ) ) ) , } } else { bail ! ( ErrorKind InvalidReply ( " " to_string ( ) ) ) ; } } else { bail ! ( ErrorKind InvalidReply ( " " to_string ( ) ) ) ; } }
Request a name on the bus.
Request a name on the bus .
&self
name
&str
flags
RequestNameFlags