pub struct Config { /* private fields */ }
Expand description
Weechat configuration file
Implementations§
Source§impl Config
impl Config
Sourcepub fn new_with_callback(
name: &str,
reload_callback: impl ConfigReloadCallback,
) -> Result<Config, ()>
pub fn new_with_callback( name: &str, reload_callback: impl ConfigReloadCallback, ) -> Result<Config, ()>
Create a new Weechat configuration file, returns a Config
object.
The configuration file is freed when the Config
object is dropped.
§Arguments
-
name
- Name of the new configuration file -
reload_callback
- Callback that will be called when the configuration file is reloaded.
§Examples
use weechat::Weechat;
use weechat::config::{Conf, Config};
let config = Config::new_with_callback("server_buffer",
|weechat: &Weechat, conf: &Conf| {
Weechat::print("Config was reloaded");
}
);
§Panics
Panics if the method is not called from the main Weechat thread.
Sourcepub fn new_section(
&mut self,
section_settings: ConfigSectionSettings,
) -> Result<SectionHandleMut<'_>, ()>
pub fn new_section( &mut self, section_settings: ConfigSectionSettings, ) -> Result<SectionHandleMut<'_>, ()>
Sourcepub fn search_section(&self, section_name: &str) -> Option<SectionHandle<'_>>
pub fn search_section(&self, section_name: &str) -> Option<SectionHandle<'_>>
Search the configuration object for a section and borrow it.
Returns a handle to a section if one is found, None otherwise.
§Arguments
section_name
- The name of the section that should be retrieved.
§Panics
This will panic if it is being called in a section read/write callback of the same section that is being retrieved or if the section is already mutably borrowed.
Sourcepub fn search_section_mut(
&mut self,
section_name: &str,
) -> Option<SectionHandleMut<'_>>
pub fn search_section_mut( &mut self, section_name: &str, ) -> Option<SectionHandleMut<'_>>
Search the configuration object for a section and borrow it mutably.
Returns a handle to a section if one is found, None otherwise.
§Arguments
section_name
- The name of the section that should be retrieved.
§Panics
This will panic if it is being called in a section read/write callback of the same section that is being retrieved or if the section is already borrowed.