File tree Expand file tree Collapse file tree 9 files changed +23
-18
lines changed Expand file tree Collapse file tree 9 files changed +23
-18
lines changed Original file line number Diff line number Diff line change @@ -146,10 +146,11 @@ mod test {
146
146
* surface. finish_output_stream ( ) . unwrap ( ) . downcast ( ) . unwrap ( )
147
147
}
148
148
149
+ #[ track_caller]
149
150
fn assert_len_close_enough ( len_a : usize , len_b : usize ) {
150
151
// It seems cairo randomizes some element IDs which might make one svg slightly
151
152
// larger than the other. Here we make sure the difference is within ~10%.
152
- let len_diff = ( len_a as isize - len_b as isize ) . abs ( ) as usize ;
153
+ let len_diff = usize :: abs_diff ( len_a, len_b) ;
153
154
assert ! ( len_diff < len_b / 10 ) ;
154
155
}
155
156
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ mod tests {
248
248
. required ( )
249
249
. value_required ( ) ;
250
250
let _ = parse_nested_meta_items ( & input. attrs , "boxed_type" , & mut [ & mut gtype_name] ) ;
251
- assert_eq ! ( gtype_name. get_found( ) , true ) ;
251
+ assert ! ( gtype_name. get_found( ) ) ;
252
252
assert_eq ! (
253
253
gtype_name. value. map( |x| x. value( ) ) ,
254
254
Some ( "Author" . to_string( ) )
@@ -271,6 +271,6 @@ mod tests {
271
271
assert ! ( gtype_name. value. is_none( ) ) ;
272
272
273
273
// The argument key must be found though
274
- assert_eq ! ( gtype_name. get_found( ) , true ) ;
274
+ assert ! ( gtype_name. get_found( ) ) ;
275
275
}
276
276
}
Original file line number Diff line number Diff line change @@ -958,7 +958,7 @@ macro_rules! impl_to_glib_container_from_slice_fundamental {
958
958
}
959
959
960
960
unsafe {
961
- let res = ffi:: g_malloc( mem:: size_of :: <$name> ( ) * t . len ( ) ) as * mut $name;
961
+ let res = ffi:: g_malloc( mem:: size_of_val ( t ) ) as * mut $name;
962
962
ptr:: copy_nonoverlapping( t. as_ptr( ) , res, t. len( ) ) ;
963
963
res
964
964
}
Original file line number Diff line number Diff line change @@ -10,9 +10,7 @@ single_version_file = true
10
10
deprecate_by_min_version = true
11
11
trust_return_value_nullability = true
12
12
13
- generate = [
14
- " PangoCairo.Font" ,
15
- ]
13
+ generate = []
16
14
17
15
manual = [
18
16
" cairo.Context" ,
@@ -101,15 +99,21 @@ status = "generate"
101
99
name = " cr"
102
100
const = true
103
101
102
+ [[object ]]
103
+ name = " PangoCairo.Font"
104
+ status = " generate"
105
+ trait_name = " PangoCairoFontExt"
106
+
104
107
[[object ]]
105
108
name = " PangoCairo.FontMap"
106
109
status = " generate"
107
- manual_traits = [" FontMapExtManual" ]
110
+ trait_name = " PangoCairoFontMapExt"
111
+ manual_traits = [" PangoCairoFontMapExtManual" ]
108
112
[[object .function ]]
109
113
# Needed because cairo types don't implement `.into_glib()`.
110
114
name = " get_font_type"
111
115
manual = true
112
- doc_trait_name = " FontMapExtManual "
116
+ doc_trait_name = " PangoCairoFontMapExtManual "
113
117
[[object .function ]]
114
118
# Needed because cairo types don't implement `.into_glib()`.
115
119
name = " new_for_font_type"
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ impl Font {
18
18
pub const NONE : Option < & ' static Font > = None ;
19
19
}
20
20
21
- pub trait FontExt : IsA < Font > + ' static {
21
+ pub trait PangoCairoFontExt : IsA < Font > + ' static {
22
22
#[ doc( alias = "pango_cairo_font_get_scaled_font" ) ]
23
23
#[ doc( alias = "get_scaled_font" ) ]
24
24
fn scaled_font ( & self ) -> Option < cairo:: ScaledFont > {
@@ -30,7 +30,7 @@ pub trait FontExt: IsA<Font> + 'static {
30
30
}
31
31
}
32
32
33
- impl < O : IsA < Font > > FontExt for O { }
33
+ impl < O : IsA < Font > > PangoCairoFontExt for O { }
34
34
35
35
impl fmt:: Display for Font {
36
36
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ impl FontMap {
25
25
}
26
26
}
27
27
28
- pub trait FontMapExt : IsA < FontMap > + ' static {
28
+ pub trait PangoCairoFontMapExt : IsA < FontMap > + ' static {
29
29
#[ doc( alias = "pango_cairo_font_map_get_resolution" ) ]
30
30
#[ doc( alias = "get_resolution" ) ]
31
31
fn resolution ( & self ) -> f64 {
@@ -40,7 +40,7 @@ pub trait FontMapExt: IsA<FontMap> + 'static {
40
40
}
41
41
}
42
42
43
- impl < O : IsA < FontMap > > FontMapExt for O { }
43
+ impl < O : IsA < FontMap > > PangoCairoFontMapExt for O { }
44
44
45
45
impl fmt:: Display for FontMap {
46
46
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
Original file line number Diff line number Diff line change @@ -12,6 +12,6 @@ pub mod functions;
12
12
13
13
#[ doc( hidden) ]
14
14
pub mod traits {
15
- pub use super :: font:: FontExt ;
16
- pub use super :: font_map:: FontMapExt ;
15
+ pub use super :: font:: PangoCairoFontExt ;
16
+ pub use super :: font_map:: PangoCairoFontMapExt ;
17
17
}
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ use glib::{prelude::*, translate::*};
4
4
5
5
use crate :: FontMap ;
6
6
7
- pub trait FontMapExtManual : IsA < FontMap > + ' static {
7
+ pub trait PangoCairoFontMapExtManual : IsA < FontMap > + ' static {
8
8
#[ doc( alias = "pango_cairo_font_map_get_font_type" ) ]
9
9
#[ doc( alias = "get_font_type" ) ]
10
10
fn font_type ( & self ) -> cairo:: FontType {
11
11
unsafe { ffi:: pango_cairo_font_map_get_font_type ( self . as_ref ( ) . to_glib_none ( ) . 0 ) . into ( ) }
12
12
}
13
13
}
14
14
15
- impl < O : IsA < FontMap > > FontMapExtManual for O { }
15
+ impl < O : IsA < FontMap > > PangoCairoFontMapExtManual for O { }
16
16
17
17
impl FontMap {
18
18
#[ doc( alias = "pango_cairo_font_map_new_for_font_type" ) ]
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ pub use glib::prelude::*;
5
5
#[ doc( hidden) ]
6
6
pub use pango:: prelude:: * ;
7
7
8
- pub use crate :: { auto:: traits:: * , font_map:: FontMapExtManual } ;
8
+ pub use crate :: { auto:: traits:: * , font_map:: PangoCairoFontMapExtManual } ;
You can’t perform that action at this time.
0 commit comments