nvim_oxi_api/opts/
clear_autocmds.rs1use crate::Buffer;
2use crate::StringOrInt;
3
4#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Debug, Default)]
7#[repr(C)]
8pub struct ClearAutocmdsOpts {
9 event: types::Object,
10 group: types::Object,
11 buffer: types::Object,
12 pattern: types::Object,
13}
14
15#[cfg(not(feature = "neovim-0-10"))] impl ClearAutocmdsOpts {
17 #[inline(always)]
19 pub fn builder() -> ClearAutocmdsOptsBuilder {
20 ClearAutocmdsOptsBuilder::default()
21 }
22}
23
24#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Default)]
26pub struct ClearAutocmdsOptsBuilder(ClearAutocmdsOpts);
27
28#[cfg(not(feature = "neovim-0-10"))] impl ClearAutocmdsOptsBuilder {
30 #[inline]
33 pub fn buffer(&mut self, buffer: Buffer) -> &mut Self {
34 self.0.buffer = buffer.into();
35 self
36 }
37
38 #[inline]
41 pub fn events<'a, I>(&mut self, iter: I) -> &mut Self
42 where
43 I: IntoIterator<Item = &'a str>,
44 {
45 self.0.event = types::Array::from_iter(iter).into();
46 self
47 }
48
49 #[inline]
54 pub fn patterns<'a, I>(&mut self, iter: I) -> &mut Self
55 where
56 I: IntoIterator<Item = &'a str>,
57 {
58 self.0.pattern = types::Array::from_iter(iter).into();
59 self
60 }
61
62 #[inline]
65 pub fn group<Grp>(&mut self, group: Grp) -> &mut Self
66 where
67 Grp: StringOrInt,
68 {
69 self.0.group = group.to_object();
70 self
71 }
72
73 #[inline]
74 pub fn build(&mut self) -> ClearAutocmdsOpts {
75 std::mem::take(&mut self.0)
76 }
77}
78
79#[cfg(feature = "neovim-0-10")] #[derive(Clone, Debug, Default, macros::OptsBuilder)]
82#[repr(C)]
83pub struct ClearAutocmdsOpts {
84 #[builder(mask)]
85 mask: u64,
86
87 #[builder(argtype = "Buffer", inline = "{0}.0")]
90 buffer: types::BufHandle,
91
92 #[builder(
95 generics = "'a, I: IntoIterator<Item = &'a str>",
96 method = "events",
97 argtype = "I",
98 inline = "types::Array::from_iter({0}).into()"
99 )]
100 event: types::Object,
101
102 #[builder(
107 generics = "G: StringOrInt",
108 argtype = "G",
109 inline = "{0}.to_object()"
110 )]
111 group: types::Object,
112
113 #[builder(
116 generics = "'a, I: IntoIterator<Item = &'a str>",
117 method = "patterns",
118 argtype = "I",
119 inline = "types::Array::from_iter({0}).into()"
120 )]
121 pattern: types::Object,
122}