use crate::Buffer;
use crate::{StringOrInt, StringOrListOfStrings};
#[cfg(feature = "neovim-0-10")] #[derive(Clone, Debug, Default, macros::OptsBuilder)]
#[repr(C)]
pub struct ExecAutocmdsOpts {
#[builder(mask)]
mask: u64,
#[builder(argtype = "Buffer", inline = "{0}.0")]
buffer: types::BufHandle,
#[builder(
generics = "G: StringOrInt",
argtype = "G",
inline = "{0}.to_object()"
)]
group: types::Object,
#[builder(argtype = "bool")]
modeline: types::Boolean,
#[builder(
generics = "P: StringOrListOfStrings",
method = "patterns",
argtype = "P",
inline = "{0}.to_object()"
)]
pattern: types::Object,
#[builder(
generics = "D: Into<types::Object>",
argtype = "D",
inline = "{0}.into()"
)]
data: types::Object,
}
#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Debug, Default)]
#[repr(C)]
pub struct ExecAutocmdsOpts {
data: types::Object,
group: types::Object,
buffer: types::Object,
patterns: types::Object,
modeline: types::Object,
}
#[cfg(not(feature = "neovim-0-10"))] impl ExecAutocmdsOpts {
#[inline(always)]
pub fn builder() -> ExecAutocmdsOptsBuilder {
ExecAutocmdsOptsBuilder::default()
}
}
#[cfg(not(feature = "neovim-0-10"))] #[derive(Clone, Default)]
pub struct ExecAutocmdsOptsBuilder(ExecAutocmdsOpts);
#[cfg(not(feature = "neovim-0-10"))] impl ExecAutocmdsOptsBuilder {
#[inline]
pub fn buffer(&mut self, buffer: Buffer) -> &mut Self {
self.0.buffer = buffer.into();
self
}
#[inline]
pub fn data(&mut self, any: impl Into<types::Object>) -> &mut Self {
self.0.data = any.into();
self
}
#[inline]
pub fn group<Grp>(&mut self, group: Grp) -> &mut Self
where
Grp: StringOrInt,
{
self.0.group = group.to_object();
self
}
#[inline]
pub fn modeline(&mut self, modeline: bool) -> &mut Self {
self.0.modeline = modeline.into();
self
}
#[inline]
pub fn patterns<Patterns>(&mut self, patterns: Patterns) -> &mut Self
where
Patterns: StringOrListOfStrings,
{
self.0.patterns = patterns.to_object();
self
}
#[inline]
pub fn build(&mut self) -> ExecAutocmdsOpts {
std::mem::take(&mut self.0)
}
}