nvim_oxi_api/opts/
get_context.rs1use crate::types::ContextType;
2
3#[cfg(feature = "neovim-0-10")] #[derive(Clone, Debug, Default, macros::OptsBuilder)]
6#[repr(C)]
7pub struct GetContextOpts {
8 #[builder(mask)]
9 mask: u64,
10
11 #[builder(
13 generics = "T: IntoIterator<Item = ContextType>",
14 argtype = "T",
15 inline = "{0}.into_iter().map(types::String::from).collect()"
16 )]
17 types: types::Array,
18}
19
20#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Debug, Default)]
23#[repr(C)]
24pub struct GetContextOpts {
25 types: types::Object,
26}
27
28#[cfg(not(feature = "neovim-0-10"))] impl GetContextOpts {
30 #[inline]
32 pub fn builder() -> GetContextOptsBuilder {
33 GetContextOptsBuilder::default()
34 }
35}
36
37#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Default)]
39pub struct GetContextOptsBuilder(GetContextOpts);
40
41#[cfg(not(feature = "neovim-0-10"))] impl GetContextOptsBuilder {
43 #[inline]
45 pub fn types<T>(&mut self, types: T) -> &mut Self
46 where
47 T: IntoIterator<Item = ContextType>,
48 {
49 self.0.types = types
50 .into_iter()
51 .map(types::String::from)
52 .collect::<types::Array>()
53 .into();
54 self
55 }
56
57 #[inline]
58 pub fn build(&mut self) -> GetContextOpts {
59 std::mem::take(&mut self.0)
60 }
61}