nvim_api/opts/
get_extmark_by_id.rs

1use derive_builder::Builder;
2use nvim_types::Dictionary;
3
4/// Options passed to
5/// [`Buffer::get_extmark_by_id`](crate::Buffer::get_extmark_by_id).
6#[derive(Clone, Debug, Default, Builder)]
7#[builder(default, build_fn(private, name = "fallible_build"))]
8pub struct GetExtmarkByIdOpts {
9    /// Whether to include the extmark's
10    /// [`ExtmarkInfos`](crate::types::ExtmarkInfos) as the last element of the
11    /// tuple returned by
12    /// [`Buffer::get_extmark_by_id`](crate::Buffer::get_extmark_by_id).
13    #[builder(setter(strip_option))]
14    details: Option<bool>,
15}
16
17impl GetExtmarkByIdOpts {
18    #[inline(always)]
19    /// Creates a new [`GetExtmarkByIdOptsBuilder`].
20    pub fn builder() -> GetExtmarkByIdOptsBuilder {
21        GetExtmarkByIdOptsBuilder::default()
22    }
23}
24
25impl GetExtmarkByIdOptsBuilder {
26    pub fn build(&mut self) -> GetExtmarkByIdOpts {
27        self.fallible_build().expect("never fails, all fields have defaults")
28    }
29}
30
31impl From<&GetExtmarkByIdOpts> for Dictionary {
32    fn from(opts: &GetExtmarkByIdOpts) -> Self {
33        Self::from_iter([("details", opts.details)])
34    }
35}