pub fn add_resource(&mut self, name: &'static str, parent: Option<&'static str>) -> Result<(), Error> {
        trace!("adding resource {} with parent {:?}", name, parent);
        if self.resources.contains_key(name) {
            warn!("adding duplicate resource: {}", name);
            return Err(Error::DuplicateResource(String::from(name)));
        } // if
        if let Some(name) = parent {
            if !self.resources.contains_key(name) {
                warn!("missing parent for new resource: {}", name);
                return Err(Error::MissingParent(String::from(name)))
            } // if
        } // if
        self.resources.insert(name, parent);
        Ok(())
    }
/// Adds a new resource. Returns an error if resource is already defined or parent is unknown.
Adds a new resource. Returns an error if resource is already defined or parent is unknown.
Adds a new resource . Returns an error if resource is already defined or parent is unknown .
pub fn add_resource(&mut self, name: &'static str, parent: Option<&'static str>) -> Result<(), Error> {
        trace!("adding resource {} with parent {:?}", name, parent);
        if self.resources.contains_key(name) {
            warn!("adding duplicate resource: {}", name);
            return Err(Error::DuplicateResource(String::from(name)));
        } // if
        if let Some(name) = parent {
            if !self.resources.contains_key(name) {
                warn!("missing parent for new resource: {}", name);
                return Err(Error::MissingParent(String::from(name)))
            } // if
        } // if
        self.resources.insert(name, parent);
        Ok(())
    }
pub fn add_resource ( & mut self , name : & ' static str , parent : Option < & ' static str > ) -> Result < ( ) , Error > { trace ! ( " " name parent ) ; if self . resources . contains_key ( name ) { warn ! ( " " name ) ; return Err ( Error :: DuplicateResource ( String :: from ( name ) ) ) ; } // if if let Some ( name ) = parent { if ! self . resources . contains_key ( name ) { warn ! ( " " name ) ; return Err ( Error :: MissingParent ( String :: from ( name ) ) ) } // if } // if self . resources . insert ( name , parent ) ; Ok ( ( ) ) }
Adds a new resource.
Adds a new resource .
&mut self
name
&'static str
parent
Option<&'static str>
&mut self
name
&'static str
parent
Option<&'static str>