pub struct ConfigSectionSettings { /* private fields */ }
Expand description
Represents the options when creating a new config section.
Implementations§
Source§impl ConfigSectionSettings
impl ConfigSectionSettings
Sourcepub fn new<P: Into<String>>(name: P) -> Self
pub fn new<P: Into<String>>(name: P) -> Self
Create a new config section info. This can be passed to a config which will create a new ConfigSection.
#Arguments
name
- The name that the section should get.
Sourcepub fn set_read_callback(self, callback: impl SectionReadCallback) -> Self
pub fn set_read_callback(self, callback: impl SectionReadCallback) -> Self
Set the function that will be called when an option from the section is read from the disk.
#Arguments
callback
- The callback for a section read operation.
§Examples
use weechat::Weechat;
use weechat::config::{Conf, ConfigSection, ConfigSectionSettings, OptionChanged};
let server_section_options = ConfigSectionSettings::new("server")
.set_read_callback(|_: &Weechat, config: &Conf, section: &mut ConfigSection,
option_name: &str, option_value: &str| {
Weechat::print("Writing section");
OptionChanged::Changed
});
Sourcepub fn set_write_callback(
self,
callback: impl FnMut(&Weechat, &Conf, &mut ConfigSection) + 'static,
) -> Self
pub fn set_write_callback( self, callback: impl FnMut(&Weechat, &Conf, &mut ConfigSection) + 'static, ) -> Self
Set the function that will be called when the section is being written to the file.
#Arguments
callback
- The callback for the section write operation.
§Examples
use weechat::Weechat;
use weechat::config::ConfigSectionSettings;
let server_section_options = ConfigSectionSettings::new("server")
.set_write_callback(|weechat, config, section| {
Weechat::print("Writing section");
});
Sourcepub fn set_write_default_callback(
self,
callback: impl FnMut(&Weechat, &Conf, &mut ConfigSection) + 'static,
) -> Self
pub fn set_write_default_callback( self, callback: impl FnMut(&Weechat, &Conf, &mut ConfigSection) + 'static, ) -> Self
Set the function that will be called when default values will need to be written to to the file.
#Arguments
callback
- The callback for the section write default operation.
Trait Implementations§
Source§impl Default for ConfigSectionSettings
impl Default for ConfigSectionSettings
Source§fn default() -> ConfigSectionSettings
fn default() -> ConfigSectionSettings
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigSectionSettings
impl !RefUnwindSafe for ConfigSectionSettings
impl !Send for ConfigSectionSettings
impl !Sync for ConfigSectionSettings
impl Unpin for ConfigSectionSettings
impl !UnwindSafe for ConfigSectionSettings
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