use crate::types::ContextType;
#[cfg(feature = "neovim-0-10")] #[derive(Clone, Debug, Default, macros::OptsBuilder)]
#[repr(C)]
pub struct GetContextOpts {
#[builder(mask)]
mask: u64,
#[builder(
generics = "T: IntoIterator<Item = ContextType>",
argtype = "T",
inline = "{0}.into_iter().map(types::String::from).collect()"
)]
types: types::Array,
}
#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Debug, Default)]
#[repr(C)]
pub struct GetContextOpts {
types: types::Object,
}
#[cfg(not(feature = "neovim-0-10"))] impl GetContextOpts {
#[inline]
pub fn builder() -> GetContextOptsBuilder {
GetContextOptsBuilder::default()
}
}
#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Default)]
pub struct GetContextOptsBuilder(GetContextOpts);
#[cfg(not(feature = "neovim-0-10"))] impl GetContextOptsBuilder {
#[inline]
pub fn types<T>(&mut self, types: T) -> &mut Self
where
T: IntoIterator<Item = ContextType>,
{
self.0.types = types
.into_iter()
.map(types::String::from)
.collect::<types::Array>()
.into();
self
}
#[inline]
pub fn build(&mut self) -> GetContextOpts {
std::mem::take(&mut self.0)
}
}