nvim_oxi_api/opts/
get_commands.rs

1/// Options passed to [`Buffer::get_commands()`](crate::Buffer::get_commands)
2/// and [`get_commands()`](crate::get_commands).
3#[derive(Clone, Debug, Default)]
4#[repr(C)]
5pub struct GetCommandsOpts {
6    #[cfg(not(feature = "neovim-0-10"))] // 0nly on 0.9.
7    builtin: types::Object,
8
9    #[cfg(feature = "neovim-0-10")] // On 0.10 and nightly.
10    builtin: bool,
11}
12
13impl GetCommandsOpts {
14    #[inline(always)]
15    pub fn builder() -> GetCommandsOptsBuilder {
16        GetCommandsOptsBuilder::default()
17    }
18}
19
20#[derive(Clone, Default)]
21pub struct GetCommandsOptsBuilder(GetCommandsOpts);
22
23impl GetCommandsOptsBuilder {
24    #[inline]
25    pub fn builtin(&mut self, builtin: bool) -> &mut Self {
26        #[cfg(not(feature = "neovim-0-10"))] // 0nly on 0.9.
27        {
28            self.0.builtin = builtin.into();
29        }
30        #[cfg(feature = "neovim-0-10")] // On 0.10 and nightly.
31        {
32            self.0.builtin = builtin;
33        }
34        self
35    }
36
37    #[inline]
38    pub fn build(&mut self) -> GetCommandsOpts {
39        std::mem::take(&mut self.0)
40    }
41}