1
+ #[ cfg( feature = "neovim-nightly" ) ]
2
+ use oxi_types:: { self as nvim, Boolean , Integer , String as NvimString } ;
3
+ #[ cfg( not( feature = "neovim-nightly" ) ) ]
1
4
use oxi_types:: { Dictionary , Object } ;
2
5
3
6
/// Options passed to
4
7
/// [`Buffer::get_extmarks()`](crate::Buffer::get_extmarks).
8
+ #[ cfg( not( feature = "neovim-nightly" ) ) ]
5
9
#[ derive( Clone , Debug , Default ) ]
10
+ #[ repr( C ) ]
6
11
pub struct GetExtmarksOpts {
7
12
details : Object ,
8
13
limits : Object ,
9
14
}
10
15
16
+ #[ cfg( feature = "neovim-nightly" ) ]
17
+ #[ derive( Clone , Debug , Default ) ]
18
+ #[ repr( C ) ]
19
+ 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 ,
37
+ }
38
+
11
39
impl GetExtmarksOpts {
12
40
#[ inline( always) ]
13
41
/// Creates a new [`GetExtmarksOptsBuilder`].
@@ -26,13 +54,53 @@ impl GetExtmarksOptsBuilder {
26
54
/// [`Buffer::get_extmarks()`](crate::Buffer::get_extmarks).
27
55
#[ inline]
28
56
pub fn details ( & mut self , details : bool ) -> & mut Self {
29
- self . 0 . details = details. into ( ) ;
57
+ #[ cfg( not( feature = "neovim-nightly" ) ) ]
58
+ {
59
+ self . 0 . details = details. into ( ) ;
60
+ }
61
+ #[ cfg( feature = "neovim-nightly" ) ]
62
+ {
63
+ self . 0 . details = details;
64
+ self . 0 . mask |= 0b1001 ;
65
+ }
66
+ self
67
+ }
68
+
69
+ #[ cfg( feature = "neovim-nightly" ) ]
70
+ #[ inline]
71
+ pub fn hl_name ( & mut self , hl_name : bool ) -> & mut Self {
72
+ self . 0 . hl_name = hl_name;
73
+ self . 0 . mask |= 0b10001 ;
30
74
self
31
75
}
32
76
33
77
#[ inline]
34
78
pub fn limits ( & mut self , limits : bool ) -> & mut Self {
35
- self . 0 . limits = limits. into ( ) ;
79
+ #[ cfg( not( feature = "neovim-nightly" ) ) ]
80
+ {
81
+ self . 0 . limits = limits. into ( ) ;
82
+ }
83
+ #[ cfg( feature = "neovim-nightly" ) ]
84
+ {
85
+ self . 0 . limits = limits as Integer ;
86
+ self . 0 . mask |= 0b101 ;
87
+ }
88
+ self
89
+ }
90
+
91
+ #[ cfg( feature = "neovim-nightly" ) ]
92
+ #[ inline]
93
+ pub fn overlap ( & mut self , overlap : bool ) -> & mut Self {
94
+ self . 0 . overlap = overlap;
95
+ self . 0 . mask |= 0b100001 ;
96
+ self
97
+ }
98
+
99
+ #[ cfg( feature = "neovim-nightly" ) ]
100
+ #[ inline]
101
+ pub fn ty < S : Into < nvim:: String > > ( & mut self , ty : S ) -> & mut Self {
102
+ self . 0 . ty = ty. into ( ) ;
103
+ self . 0 . mask |= 0b11 ;
36
104
self
37
105
}
38
106
@@ -43,6 +111,7 @@ impl GetExtmarksOptsBuilder {
43
111
}
44
112
}
45
113
114
+ #[ cfg( not( feature = "neovim-nightly" ) ) ]
46
115
impl From < & GetExtmarksOpts > for Dictionary {
47
116
fn from ( opts : & GetExtmarksOpts ) -> Self {
48
117
Self :: from_iter ( [
0 commit comments