@@ -15,8 +15,8 @@ use geometrify::{ProgressReporter, RandomPointGenerator, Filter};
15
15
use geometrify:: geometrify:: Geometrify ;
16
16
17
17
use image:: open;
18
- use std:: path:: Path ;
19
18
use std:: io:: Stdout ;
19
+ use std:: path:: Path ;
20
20
21
21
use pbr:: ProgressBar ;
22
22
@@ -26,9 +26,7 @@ struct PbrProgressReporter {
26
26
27
27
impl PbrProgressReporter {
28
28
fn new ( ) -> PbrProgressReporter {
29
- PbrProgressReporter {
30
- bar : None ,
31
- }
29
+ PbrProgressReporter { bar : None }
32
30
}
33
31
}
34
32
@@ -40,13 +38,17 @@ impl ProgressReporter for PbrProgressReporter {
40
38
}
41
39
42
40
fn step ( & mut self ) {
43
- let ref mut bar = self . bar . as_mut ( ) . expect ( "ProgressReporter was not initialized" ) ;
41
+ let ref mut bar = self . bar
42
+ . as_mut ( )
43
+ . expect ( "ProgressReporter was not initialized" ) ;
44
44
bar. inc ( ) ;
45
45
}
46
46
47
47
fn finish ( & mut self ) {
48
48
{
49
- let ref mut bar = self . bar . as_mut ( ) . expect ( "ProgressReporter was not initialized" ) ;
49
+ let ref mut bar = self . bar
50
+ . as_mut ( )
51
+ . expect ( "ProgressReporter was not initialized" ) ;
50
52
bar. finish ( ) ;
51
53
}
52
54
self . bar = None ;
@@ -61,35 +63,36 @@ fn main() {
61
63
Arg :: with_name ( "INPUT" )
62
64
. required ( true )
63
65
. help ( "Input file" )
64
- . index ( 1 )
66
+ . index ( 1 ) ,
65
67
)
66
68
. arg (
67
69
Arg :: with_name ( "OUTPUT" )
68
70
. required ( true )
69
71
. help ( "Output file" )
70
- . index ( 2 )
72
+ . index ( 2 ) ,
71
73
)
72
74
. arg (
73
75
Arg :: with_name ( "samples" )
74
76
. short ( "s" )
75
77
. long ( "samples" )
76
78
. help ( "Number of primitives to select from" )
77
79
. default_value ( "50" )
78
- . takes_value ( true )
80
+ . takes_value ( true ) ,
79
81
)
80
82
. arg (
81
83
Arg :: with_name ( "iterations" )
82
84
. short ( "i" )
83
85
. long ( "iterations" )
84
86
. default_value ( "100" )
85
87
. help ( "Number of primitives to place" )
86
- . takes_value ( true )
88
+ . takes_value ( true ) ,
87
89
)
88
90
. get_matches ( ) ;
89
91
90
92
91
- let source = open ( & Path :: new ( matches. value_of ( "INPUT" ) . expect ( "expected input file" ) ) )
92
- . expect ( "Can't open source file" ) ;
93
+ let source = open ( & Path :: new (
94
+ matches. value_of ( "INPUT" ) . expect ( "expected input file" ) ,
95
+ ) ) . expect ( "Can't open source file" ) ;
93
96
let sourcebuf = source. to_rgba ( ) ;
94
97
95
98
@@ -112,6 +115,8 @@ fn main() {
112
115
let outputbuf = filter. apply ( & sourcebuf, & mut progress) ;
113
116
114
117
outputbuf
115
- . save ( & Path :: new ( matches. value_of ( "OUTPUT" ) . expect ( "expected output file" ) ) )
118
+ . save ( & Path :: new (
119
+ matches. value_of ( "OUTPUT" ) . expect ( "expected output file" ) ,
120
+ ) )
116
121
. expect ( "Can't save image" ) ;
117
122
}
0 commit comments