nvim_oxi_api/opts/
exec_autocmds.rs1use crate::Buffer;
2use crate::{StringOrInt, StringOrListOfStrings};
3
4#[cfg(feature = "neovim-0-10")] #[derive(Clone, Debug, Default, macros::OptsBuilder)]
7#[repr(C)]
8pub struct ExecAutocmdsOpts {
9 #[builder(mask)]
10 mask: u64,
11
12 #[builder(argtype = "Buffer", inline = "{0}.0")]
15 buffer: types::BufHandle,
16
17 #[builder(
19 generics = "G: StringOrInt",
20 argtype = "G",
21 inline = "{0}.to_object()"
22 )]
23 group: types::Object,
24
25 #[builder(argtype = "bool")]
27 modeline: types::Boolean,
28
29 #[builder(
32 generics = "P: StringOrListOfStrings",
33 method = "patterns",
34 argtype = "P",
35 inline = "{0}.to_object()"
36 )]
37 pattern: types::Object,
38
39 #[builder(
40 generics = "D: Into<types::Object>",
41 argtype = "D",
42 inline = "{0}.into()"
43 )]
44 data: types::Object,
45}
46
47#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Debug, Default)]
50#[repr(C)]
51pub struct ExecAutocmdsOpts {
52 data: types::Object,
53 group: types::Object,
54 buffer: types::Object,
55 patterns: types::Object,
56 modeline: types::Object,
57}
58
59#[cfg(not(feature = "neovim-0-10"))] impl ExecAutocmdsOpts {
61 #[inline(always)]
62 pub fn builder() -> ExecAutocmdsOptsBuilder {
63 ExecAutocmdsOptsBuilder::default()
64 }
65}
66
67#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Default)]
69pub struct ExecAutocmdsOptsBuilder(ExecAutocmdsOpts);
70
71#[cfg(not(feature = "neovim-0-10"))] impl ExecAutocmdsOptsBuilder {
73 #[inline]
76 pub fn buffer(&mut self, buffer: Buffer) -> &mut Self {
77 self.0.buffer = buffer.into();
78 self
79 }
80
81 #[inline]
82 pub fn data(&mut self, any: impl Into<types::Object>) -> &mut Self {
83 self.0.data = any.into();
84 self
85 }
86
87 #[inline]
89 pub fn group<Grp>(&mut self, group: Grp) -> &mut Self
90 where
91 Grp: StringOrInt,
92 {
93 self.0.group = group.to_object();
94 self
95 }
96
97 #[inline]
99 pub fn modeline(&mut self, modeline: bool) -> &mut Self {
100 self.0.modeline = modeline.into();
101 self
102 }
103
104 #[inline]
107 pub fn patterns<Patterns>(&mut self, patterns: Patterns) -> &mut Self
108 where
109 Patterns: StringOrListOfStrings,
110 {
111 self.0.patterns = patterns.to_object();
112 self
113 }
114
115 #[inline]
116 pub fn build(&mut self) -> ExecAutocmdsOpts {
117 std::mem::take(&mut self.0)
118 }
119}