pub struct KconfigFile {
pub root_dir: PathBuf,
pub file: PathBuf,
pub global_vars: Rc<HashMap<String, String>>,
pub local_vars: Rc<HashMap<String, String>>,
pub external_functions: Rc<HashMap<String, String>>,
pub depth: usize,
pub parent_file: Option<PathBuf>,
}Expand description
Represents a Kconfig file.
It stores the kernel root directory because we need this information when a source keyword is met.
Fields§
§root_dir: PathBufThe absolute path of the kernel root directory. This field is necessary to parse source entry.
file: PathBufThe path the the Kconfig you want to parse.
global_vars: Rc<HashMap<String, String>>Externally-specified variables to use when including child source files
local_vars: Rc<HashMap<String, String>>§external_functions: Rc<HashMap<String, String>>§depth: usize§parent_file: Option<PathBuf>Implementations§
Source§impl KconfigFile
impl KconfigFile
pub fn new(root_dir: PathBuf, file: PathBuf) -> Self
pub fn new_with_vars<S: AsRef<str>>( root_dir: PathBuf, file: PathBuf, global_vars: &HashMap<S, S>, local_vars: &HashMap<S, S>, ) -> Self
pub fn with_external_functions( self, external_functions: &HashMap<String, String>, ) -> Self
pub fn new_source_file(&self, path: PathBuf) -> Self
pub fn vars(&self) -> HashMap<String, String>
pub fn global_vars(&self) -> &HashMap<String, String>
pub fn full_path(&self) -> PathBuf
pub fn read_to_string(&self) -> Result<String>
pub fn set_global_vars<S: AsRef<str>>(&mut self, vars: &[(S, S)])
pub fn add_local_var<S: AsRef<str>>(&mut self, key: S, value: S)
pub fn add_local_vars(&mut self, new_vars: HashMap<String, String>)
pub fn preprocess_content(&self, content: String) -> String
Trait Implementations§
Source§impl Clone for KconfigFile
impl Clone for KconfigFile
Source§fn clone(&self) -> KconfigFile
fn clone(&self) -> KconfigFile
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KconfigFile
impl Debug for KconfigFile
Source§impl Default for KconfigFile
impl Default for KconfigFile
Source§fn default() -> KconfigFile
fn default() -> KconfigFile
Returns the “default value” for a type. Read more
impl Eq for KconfigFile
Source§impl PartialEq for KconfigFile
impl PartialEq for KconfigFile
impl StructuralPartialEq for KconfigFile
Auto Trait Implementations§
impl !Send for KconfigFile
impl !Sync for KconfigFile
impl Freeze for KconfigFile
impl RefUnwindSafe for KconfigFile
impl Unpin for KconfigFile
impl UnsafeUnpin for KconfigFile
impl UnwindSafe for KconfigFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more