nvim_api/opts/
get_commands.rs

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