pub fn add_object<P>(&mut self, path: P, ifaces: InterfacesBuilder) -> Result<&mut Self>
        where P: ToString,
    {
        if !self.can_handle {
            bail!(ErrorKind::NoServerName);
        }

        // TODO: Validate the path is valid.

        match self.objects.entry(path.to_string()) {
            Entry::Vacant(v) => {
                // TODO: store this
                let children = Rc::new(RefCell::new(vec![]));
                let finalized_ifaces = ifaces.finalize(&children)?;
                let obj = Object::new(path, finalized_ifaces);

                // TODO: emit InterfacesAdded signal

                v.insert(obj);

                Ok(())
            },
            Entry::Occupied(_) => bail!(ErrorKind::PathAlreadyRegistered(path.to_string())),
        }
        .map(|_| self)
    }
/// Add an object to the server with the given interfaces.
Add an object to the server with the given interfaces.
Add an object to the server with the given interfaces .
pub fn add_object<P>(&mut self, path: P, ifaces: InterfacesBuilder) -> Result<&mut Self>
        where P: ToString,
    {
        if !self.can_handle {
            bail!(ErrorKind::NoServerName);
        }
        // TODO: Validate the path is valid.
        match self.objects.entry(path.to_string()) {
            Entry::Vacant(v) => {
                // TODO: store this
                let children = Rc::new(RefCell::new(vec![]));
                let finalized_ifaces = ifaces.finalize(&children)?;
                let obj = Object::new(path, finalized_ifaces);
                // TODO: emit InterfacesAdded signal
                v.insert(obj);
                Ok(())
            },
            Entry::Occupied(_) => bail!(ErrorKind::PathAlreadyRegistered(path.to_string())),
        }
        .map(|_| self)
    }
pub fn add_object < P > ( & mut self , path : P , ifaces : InterfacesBuilder ) -> Result < & mut Self > where P : ToString , { if ! self . can_handle { bail ! ( ErrorKind NoServerName ) ; } // TODO: Validate the path is valid. match self . objects . entry ( path . to_string ( ) ) { Entry :: Vacant ( v ) => { // TODO: store this let children = Rc :: new ( RefCell :: new ( vec ! [ ] ) ) ; let finalized_ifaces = ifaces . finalize ( & children ) ? ; let obj = Object :: new ( path , finalized_ifaces ) ; // TODO: emit InterfacesAdded signal v . insert ( obj ) ; Ok ( ( ) ) } , Entry :: Occupied ( _ ) => bail ! ( ErrorKind PathAlreadyRegistered ( path to_string ( ) ) ) , } . map ( | _ | self ) }
Add an object to the server with the given interfaces.
Add an object to the server with the given interfaces .
&mut self
path
P
ifaces
InterfacesBuilder