pub async fn add_component(&mut self, id: &str) -> Result<()> {
        let id = id.to_lowercase();

        info!("adding component '{}'", id);
        let component_path = self.local_path(&id);
        let component = if !Path::new(&component_path).exists() {
            self.load_component(&id).await?
        } else {
            let component_yaml = fs::read_to_string(component_path)?;
            self.parse_component(&id, &component_yaml)?
        };
        self.components.push(component);
        Ok(())
    }
/// Adds component to library config.
///
/// # Examples
///
/// ```
/// use qeda::library::Library;
///
/// let mut lib = Library::new();
/// let mut rt = tokio::runtime::Runtime::new().unwrap();
/// rt.block_on(lib.add_component("capacitor/c0603")).unwrap();
///
/// assert_eq!(lib.components.len(), 1);
/// ```
Adds component to library config.
Adds component to library config .
pub async fn add_component(&mut self, id: &str) -> Result<()> {
        let id = id.to_lowercase();
        info!("adding component '{}'", id);
        let component_path = self.local_path(&id);
        let component = if !Path::new(&component_path).exists() {
            self.load_component(&id).await?
        } else {
            let component_yaml = fs::read_to_string(component_path)?;
            self.parse_component(&id, &component_yaml)?
        };
        self.components.push(component);
        Ok(())
    }
pub async fn add_component ( & mut self , id : & str ) -> Result < ( ) > { let id = id . to_lowercase ( ) ; info ! ( " " id ) ; let component_path = self . local_path ( & id ) ; let component = if ! Path :: new ( & component_path ) . exists ( ) { self . load_component ( & id ) . await ? } else { let component_yaml = fs :: read_to_string ( component_path ) ? ; self . parse_component ( & id , & component_yaml ) ? } ; self . components . push ( component ) ; Ok ( ( ) ) }
Adds component to library config.
Adds component to library config .
&mut self
id
&str
&mut self
id
&str
examples
```
use qeda::library::Library.

let mut lib = Library::new();
let mut rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(lib.add_component("capacitor/c0603")).unwrap().


` ` ` use qeda :: library :: Library . let mut lib = Library :: new () ; let mut rt = tokio :: runtime :: Runtime :: new () . unwrap () ; rt . block_on ( lib . add_component ( " capacitor / c0603 " )) . unwrap () .