nvim_api/opts/
create_augroup.rs

1use derive_builder::Builder;
2use nvim_types::Object;
3
4/// Options passed to `crate::api::create_augroup`.
5#[derive(Clone, Debug, Default, Builder)]
6#[builder(default, build_fn(private, name = "fallible_build"))]
7pub struct CreateAugroupOpts {
8    /// Whether to clear existing commands if the group already exists.
9    #[builder(setter(strip_option))]
10    clear: Option<bool>,
11}
12
13impl CreateAugroupOpts {
14    #[inline(always)]
15    pub fn builder() -> CreateAugroupOptsBuilder {
16        CreateAugroupOptsBuilder::default()
17    }
18}
19
20impl CreateAugroupOptsBuilder {
21    pub fn build(&mut self) -> CreateAugroupOpts {
22        self.fallible_build().expect("never fails, all fields have defaults")
23    }
24}
25
26#[derive(Default)]
27#[allow(non_camel_case_types)]
28#[repr(C)]
29pub(crate) struct KeyDict_create_augroup {
30    clear: Object,
31}
32
33impl From<&CreateAugroupOpts> for KeyDict_create_augroup {
34    fn from(opts: &CreateAugroupOpts) -> Self {
35        Self { clear: opts.clear.into() }
36    }
37}