[][src]Struct weechat::config::BooleanOptionSettings

pub struct BooleanOptionSettings { /* fields omitted */ }

Settings for a new boolean option.

Implementations

impl BooleanOptionSettings[src]

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

Create new settings that can be used to create a new boolean option.

Arguments

  • name - The name of the new option.

pub fn description<D: Into<String>>(self, descritpion: D) -> Self[src]

Set the description of the option.

Arguments

  • description - The description of the new option.

pub fn default_value(self, value: bool) -> Self[src]

Set the default value of the option.

This is the value the option will have if it isn't set by the user. If the option is reset, the option will take this value.

Arguments

  • value - The value that should act as the default value.

pub fn set_change_callback(
    self,
    callback: impl FnMut(&Weechat, &BooleanOption) + 'static
) -> Self
[src]

Set the callback that will run when the value of the option changes.

Arguments

  • callback - The callback that will be run.

Examples

use weechat::Weechat;
use weechat::config::BooleanOptionSettings;

let settings = BooleanOptionSettings::new("autoconnect")
    .set_change_callback(|weechat, option| {
        Weechat::print("Option changed");
    });

Trait Implementations

impl Default for BooleanOptionSettings[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.