[][src]Struct weechat::config::ConfigSectionSettings

pub struct ConfigSectionSettings { /* fields omitted */ }

Represents the options when creating a new config section.

Implementations

impl ConfigSectionSettings[src]

pub fn new<P: Into<String>>(name: P) -> Self[src]

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.

pub fn set_read_callback(self, callback: impl SectionReadCallback) -> Self[src]

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
});

pub fn set_write_callback(
    self,
    callback: impl FnMut(&Weechat, &Conf, &mut ConfigSection) + 'static
) -> Self
[src]

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");
});

pub fn set_write_default_callback(
    self,
    callback: impl FnMut(&Weechat, &Conf, &mut ConfigSection) + 'static
) -> Self
[src]

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

impl Default for ConfigSectionSettings[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.