1
1
// Take a look at the license at the top of the repository in the LICENSE file.
2
2
3
- #[ cfg( any ( feature = "script" , feature = "dox" ) ) ]
3
+ #[ cfg( feature = "script" ) ]
4
4
use std:: ffi:: CString ;
5
5
#[ cfg( feature = "use_glib" ) ]
6
6
use std:: marker:: PhantomData ;
7
- #[ cfg( any ( feature = "script" , feature = "dox" ) ) ]
7
+ #[ cfg( feature = "script" ) ]
8
8
use std:: path:: Path ;
9
9
use std:: { fmt, ptr} ;
10
10
11
11
#[ cfg( feature = "use_glib" ) ]
12
12
use glib:: translate:: * ;
13
13
14
14
use crate :: { utils:: status_to_result, DeviceType , Error } ;
15
- #[ cfg( any ( feature = "script" , feature = "dox" ) ) ]
15
+ #[ cfg( feature = "script" ) ]
16
16
use crate :: { Content , RecordingSurface , ScriptMode , Surface } ;
17
17
18
18
#[ derive( Debug ) ]
@@ -56,7 +56,8 @@ impl Device {
56
56
self . 0 . as_ptr ( )
57
57
}
58
58
59
- #[ cfg( any( feature = "script" , feature = "dox" ) ) ]
59
+ #[ cfg( feature = "script" ) ]
60
+ #[ cfg_attr( docsrs, doc( cfg( feature = "script" ) ) ) ]
60
61
#[ doc( alias = "cairo_script_create" ) ]
61
62
pub fn create < P : AsRef < Path > > ( filename : P ) -> Option < Device > {
62
63
unsafe {
@@ -71,7 +72,8 @@ impl Device {
71
72
}
72
73
}
73
74
74
- #[ cfg( any( feature = "script" , feature = "dox" ) ) ]
75
+ #[ cfg( feature = "script" ) ]
76
+ #[ cfg_attr( docsrs, doc( cfg( feature = "script" ) ) ) ]
75
77
#[ doc( alias = "cairo_script_from_recording_surface" ) ]
76
78
pub fn from_recording_surface ( & self , surface : & RecordingSurface ) -> Result < ( ) , Error > {
77
79
unsafe {
@@ -81,20 +83,23 @@ impl Device {
81
83
}
82
84
}
83
85
84
- #[ cfg( any( feature = "script" , feature = "dox" ) ) ]
86
+ #[ cfg( feature = "script" ) ]
87
+ #[ cfg_attr( docsrs, doc( cfg( feature = "script" ) ) ) ]
85
88
#[ doc( alias = "cairo_script_get_mode" ) ]
86
89
#[ doc( alias = "get_mode" ) ]
87
90
pub fn mode ( & self ) -> ScriptMode {
88
91
unsafe { ScriptMode :: from ( ffi:: cairo_script_get_mode ( self . to_raw_none ( ) ) ) }
89
92
}
90
93
91
- #[ cfg( any( feature = "script" , feature = "dox" ) ) ]
94
+ #[ cfg( feature = "script" ) ]
95
+ #[ cfg_attr( docsrs, doc( cfg( feature = "script" ) ) ) ]
92
96
#[ doc( alias = "cairo_script_set_mode" ) ]
93
97
pub fn set_mode ( & self , mode : ScriptMode ) {
94
98
unsafe { ffi:: cairo_script_set_mode ( self . to_raw_none ( ) , mode. into ( ) ) }
95
99
}
96
100
97
- #[ cfg( any( feature = "script" , feature = "dox" ) ) ]
101
+ #[ cfg( feature = "script" ) ]
102
+ #[ cfg_attr( docsrs, doc( cfg( feature = "script" ) ) ) ]
98
103
#[ doc( alias = "cairo_script_surface_create" ) ]
99
104
pub fn surface_create (
100
105
& self ,
@@ -112,7 +117,8 @@ impl Device {
112
117
}
113
118
}
114
119
115
- #[ cfg( any( feature = "script" , feature = "dox" ) ) ]
120
+ #[ cfg( feature = "script" ) ]
121
+ #[ cfg_attr( docsrs, doc( cfg( feature = "script" ) ) ) ]
116
122
#[ doc( alias = "cairo_script_surface_create_for_target" ) ]
117
123
pub fn surface_create_for_target ( & self , target : impl AsRef < Surface > ) -> Result < Surface , Error > {
118
124
let target = target. as_ref ( ) ;
@@ -125,7 +131,8 @@ impl Device {
125
131
}
126
132
}
127
133
128
- #[ cfg( any( feature = "script" , feature = "dox" ) ) ]
134
+ #[ cfg( feature = "script" ) ]
135
+ #[ cfg_attr( docsrs, doc( cfg( feature = "script" ) ) ) ]
129
136
#[ doc( alias = "cairo_script_write_comment" ) ]
130
137
pub fn write_comment ( & self , comment : & str ) {
131
138
unsafe {
@@ -195,7 +202,8 @@ impl Device {
195
202
unsafe { ffi:: cairo_device_observer_stroke_elapsed ( self . to_raw_none ( ) ) }
196
203
}
197
204
198
- #[ cfg( any( feature = "xlib" , feature = "xcb" , feature = "dox" ) ) ]
205
+ #[ cfg( any( feature = "xlib" , feature = "xcb" ) ) ]
206
+ #[ cfg_attr( docsrs, doc( cfg( any( feature = "xlib" , feature = "xcb" ) ) ) ) ]
199
207
#[ doc( alias = "cairo_xlib_device_debug_cap_xrender_version" ) ]
200
208
#[ doc( alias = "cairo_xcb_device_debug_cap_xrender_version" ) ]
201
209
pub fn debug_cap_xrender_version ( & self , _major_version : i32 , _minor_version : i32 ) {
@@ -232,7 +240,8 @@ impl Device {
232
240
}
233
241
}
234
242
235
- #[ cfg( any( feature = "xlib" , feature = "xcb" , feature = "dox" ) ) ]
243
+ #[ cfg( any( feature = "xlib" , feature = "xcb" ) ) ]
244
+ #[ cfg_attr( docsrs, doc( cfg( any( feature = "xlib" , feature = "xcb" ) ) ) ) ]
236
245
#[ doc( alias = "cairo_xlib_device_debug_get_precision" ) ]
237
246
#[ doc( alias = "cairo_xcb_device_debug_get_precision" ) ]
238
247
pub fn debug_get_precision ( & self ) -> i32 {
@@ -261,7 +270,8 @@ impl Device {
261
270
}
262
271
}
263
272
264
- #[ cfg( any( feature = "xlib" , feature = "xcb" , feature = "dox" ) ) ]
273
+ #[ cfg( any( feature = "xlib" , feature = "xcb" ) ) ]
274
+ #[ cfg_attr( docsrs, doc( cfg( any( feature = "xlib" , feature = "xcb" ) ) ) ) ]
265
275
#[ doc( alias = "cairo_xlib_device_debug_set_precision" ) ]
266
276
#[ doc( alias = "cairo_xcb_device_debug_set_precision" ) ]
267
277
pub fn debug_set_precision ( & self , _precision : i32 ) {
@@ -304,6 +314,7 @@ impl Device {
304
314
}
305
315
306
316
#[ cfg( feature = "use_glib" ) ]
317
+ #[ cfg_attr( docsrs, doc( cfg( feature = "use_glib" ) ) ) ]
307
318
impl IntoGlibPtr < * mut ffi:: cairo_device_t > for Device {
308
319
#[ inline]
309
320
unsafe fn into_glib_ptr ( self ) -> * mut ffi:: cairo_device_t {
@@ -312,6 +323,7 @@ impl IntoGlibPtr<*mut ffi::cairo_device_t> for Device {
312
323
}
313
324
314
325
#[ cfg( feature = "use_glib" ) ]
326
+ #[ cfg_attr( docsrs, doc( cfg( feature = "use_glib" ) ) ) ]
315
327
impl < ' a > ToGlibPtr < ' a , * mut ffi:: cairo_device_t > for Device {
316
328
type Storage = PhantomData < & ' a Device > ;
317
329
@@ -327,6 +339,7 @@ impl<'a> ToGlibPtr<'a, *mut ffi::cairo_device_t> for Device {
327
339
}
328
340
329
341
#[ cfg( feature = "use_glib" ) ]
342
+ #[ cfg_attr( docsrs, doc( cfg( feature = "use_glib" ) ) ) ]
330
343
impl FromGlibPtrNone < * mut ffi:: cairo_device_t > for Device {
331
344
#[ inline]
332
345
unsafe fn from_glib_none ( ptr : * mut ffi:: cairo_device_t ) -> Device {
@@ -335,6 +348,7 @@ impl FromGlibPtrNone<*mut ffi::cairo_device_t> for Device {
335
348
}
336
349
337
350
#[ cfg( feature = "use_glib" ) ]
351
+ #[ cfg_attr( docsrs, doc( cfg( feature = "use_glib" ) ) ) ]
338
352
impl FromGlibPtrBorrow < * mut ffi:: cairo_device_t > for Device {
339
353
#[ inline]
340
354
unsafe fn from_glib_borrow ( ptr : * mut ffi:: cairo_device_t ) -> crate :: Borrowed < Device > {
@@ -343,6 +357,7 @@ impl FromGlibPtrBorrow<*mut ffi::cairo_device_t> for Device {
343
357
}
344
358
345
359
#[ cfg( feature = "use_glib" ) ]
360
+ #[ cfg_attr( docsrs, doc( cfg( feature = "use_glib" ) ) ) ]
346
361
impl FromGlibPtrFull < * mut ffi:: cairo_device_t > for Device {
347
362
#[ inline]
348
363
unsafe fn from_glib_full ( ptr : * mut ffi:: cairo_device_t ) -> Device {
0 commit comments