nvim_oxi_api/opts/
option.rs1use serde::Serialize;
2use types::conversion::FromObject;
3
4use crate::{Buffer, Window};
5
6#[derive(Clone, Debug, Default, macros::OptsBuilder)]
9#[repr(C)]
10pub struct OptionOpts {
11 #[builder(mask)]
12 mask: u64,
13
14 #[builder(argtype = "OptionScope", inline = "{0}.into()")]
15 scope: types::String,
16
17 #[builder(argtype = "Window", inline = "{0}.0")]
18 win: types::WinHandle,
19
20 #[builder(method = "buffer", argtype = "Buffer", inline = "{0}.0")]
21 buf: types::BufHandle,
22
23 #[builder(
24 generics = "F: Into<types::String>",
25 argtype = "F",
26 inline = "{0}.into()"
27 )]
28 filetype: types::String,
29}
30
31#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize)]
32#[serde(rename_all = "lowercase")]
33pub enum OptionScope {
34 Global,
35 Local,
36}
37
38impl From<OptionScope> for types::String {
39 #[inline]
40 fn from(ctx: OptionScope) -> Self {
41 types::String::from_object(
42 ctx.serialize(types::serde::Serializer::new())
43 .expect("`OptionScope` is serializable"),
44 )
45 .expect("`OptionScope` is serialized into a string")
46 }
47}