nvim_oxi_api/opts/
create_augroup.rs

1/// Options passed to [`create_augroup()`](crate::create_augroup).
2#[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly.
3#[derive(Clone, Debug, Default, macros::OptsBuilder)]
4#[repr(C)]
5pub struct CreateAugroupOpts {
6    #[builder(mask)]
7    mask: u64,
8
9    /// Whether to clear existing commands if the group already exists.
10    #[builder(argtype = "bool")]
11    clear: types::Boolean,
12}
13
14/// Options passed to [`create_augroup()`](crate::create_augroup).
15#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10.
16#[derive(Clone, Debug, Default)]
17#[repr(C)]
18pub struct CreateAugroupOpts {
19    clear: types::Object,
20}
21
22#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10.
23impl CreateAugroupOpts {
24    #[inline(always)]
25    pub fn builder() -> CreateAugroupOptsBuilder {
26        CreateAugroupOptsBuilder::default()
27    }
28}
29
30#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10.
31#[derive(Clone, Default)]
32pub struct CreateAugroupOptsBuilder(CreateAugroupOpts);
33
34#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10.
35impl CreateAugroupOptsBuilder {
36    /// Whether to clear existing commands if the group already exists.
37    #[inline]
38    pub fn clear(&mut self, clear: bool) -> &mut Self {
39        self.0.clear = clear.into();
40        self
41    }
42
43    #[inline]
44    pub fn build(&mut self) -> CreateAugroupOpts {
45        std::mem::take(&mut self.0)
46    }
47}