1
- #[ cfg( feature = "neovim-nightly" ) ]
2
- use oxi_types:: { self as nvim, Boolean , Integer , String as NvimString } ;
3
- #[ cfg( not( feature = "neovim-nightly" ) ) ]
4
- use oxi_types:: { Dictionary , Object } ;
1
+ use oxi_types as types;
5
2
6
3
/// Options passed to
7
4
/// [`Buffer::get_extmarks()`](crate::Buffer::get_extmarks).
8
- #[ cfg( not( feature = "neovim-nightly" ) ) ]
9
- #[ derive( Clone , Debug , Default ) ]
10
- #[ repr( C ) ]
11
- pub struct GetExtmarksOpts {
12
- details : Object ,
13
- limits : Object ,
14
- }
15
-
16
- #[ cfg( feature = "neovim-nightly" ) ]
5
+ #[ cfg( any( feature = "neovim-0-8" , feature = "neovim-0-9" ) ) ]
17
6
#[ derive( Clone , Debug , Default ) ]
18
7
#[ repr( C ) ]
19
8
pub struct GetExtmarksOpts {
20
- /// <overlap><hl_name><details><limit><type>1
21
- mask : u64 ,
22
-
23
- /// 2nd in the mask.
24
- limits : Integer ,
25
-
26
- /// 3rd in the mask.
27
- details : Boolean ,
28
-
29
- /// 4th in the mask.
30
- hl_name : Boolean ,
31
-
32
- /// 5th in the mask.
33
- overlap : Boolean ,
34
-
35
- /// 1st in the mask.
36
- ty : NvimString ,
9
+ details : types:: Object ,
10
+ limits : types:: Object ,
37
11
}
38
12
13
+ #[ cfg( any( feature = "neovim-0-8" , feature = "neovim-0-9" ) ) ]
39
14
impl GetExtmarksOpts {
40
15
#[ inline( always) ]
41
16
/// Creates a new [`GetExtmarksOptsBuilder`].
@@ -44,9 +19,11 @@ impl GetExtmarksOpts {
44
19
}
45
20
}
46
21
22
+ #[ cfg( any( feature = "neovim-0-8" , feature = "neovim-0-9" ) ) ]
47
23
#[ derive( Clone , Default ) ]
48
24
pub struct GetExtmarksOptsBuilder ( GetExtmarksOpts ) ;
49
25
26
+ #[ cfg( any( feature = "neovim-0-8" , feature = "neovim-0-9" ) ) ]
50
27
impl GetExtmarksOptsBuilder {
51
28
/// Whether to include the extmark's
52
29
/// [`ExtmarkInfos`](crate::types::ExtmarkInfos) as the last element of
@@ -111,12 +88,52 @@ impl GetExtmarksOptsBuilder {
111
88
}
112
89
}
113
90
114
- #[ cfg( not ( feature = "neovim-nightly " ) ) ]
115
- impl From < & GetExtmarksOpts > for Dictionary {
91
+ #[ cfg( any ( feature = "neovim-0-8" , feature = "neovim-0-9 ") ) ]
92
+ impl From < & GetExtmarksOpts > for types :: Dictionary {
116
93
fn from ( opts : & GetExtmarksOpts ) -> Self {
117
94
Self :: from_iter ( [
118
95
( "details" , opts. details . clone ( ) ) ,
119
96
( "limits" , opts. limits . clone ( ) ) ,
120
97
] )
121
98
}
122
99
}
100
+
101
+ #[ cfg( feature = "neovim-nightly" ) ]
102
+ #[ derive( Clone , Debug , Default , oxi_macros:: OptsBuilder ) ]
103
+ #[ repr( C ) ]
104
+ /// Options passed to
105
+ /// [`Buffer::get_extmarks()`](crate::Buffer::get_extmarks).
106
+ pub struct GetExtmarksOpts {
107
+ #[ builder( mask) ]
108
+ mask : u64 ,
109
+
110
+ #[ builder(
111
+ method = "limits" ,
112
+ argtype = "bool" ,
113
+ inline = "{0} as types::Integer"
114
+ ) ]
115
+ limit : types:: Integer ,
116
+
117
+ /// Whether to include the extmark's
118
+ /// [`ExtmarkInfos`](crate::types::ExtmarkInfos) as the last element of
119
+ /// the tuples returned by
120
+ /// [`Buffer::get_extmarks()`](crate::Buffer::get_extmarks).
121
+ #[ builder( argtype = "bool" ) ]
122
+ details : types:: Boolean ,
123
+
124
+ #[ builder( argtype = "bool" ) ]
125
+ hl_name : types:: Boolean ,
126
+
127
+ #[ builder( argtype = "bool" ) ]
128
+ overlap : types:: Boolean ,
129
+
130
+ // TODO: fix `Into`.
131
+ // TODO: name it `type` instead of `ty`.
132
+ // #[builder(Into)]
133
+ #[ builder(
134
+ generics = "S: Into<types::String>" ,
135
+ argtype = "S" ,
136
+ inline = "{0}.into()"
137
+ ) ]
138
+ ty : types:: String ,
139
+ }
0 commit comments