@@ -54,22 +54,32 @@ pub struct Opt {
54
54
/// Rust code from one shared object or executable depends on these C++
55
55
/// functions in another.
56
56
pub cxx_impl_annotations : Option < String > ,
57
+ /// Optional [`CfgEvaluator`] for handling cfg attributes
58
+ pub cfg_evaluator : Box < dyn CfgEvaluator > ,
57
59
58
60
pub ( super ) gen_header : bool ,
59
61
pub ( super ) gen_implementation : bool ,
60
62
pub ( super ) allow_dot_includes : bool ,
61
- pub ( super ) cfg_evaluator : Box < dyn CfgEvaluator > ,
62
63
pub ( super ) doxygen : bool ,
63
64
}
64
65
65
- pub ( super ) trait CfgEvaluator {
66
+ /// An evaluator which parses cfg attributes
67
+ pub trait CfgEvaluator {
68
+ /// For a given cfg name and value return a [`CfgResult`] indicating if it's enabled
66
69
fn eval ( & self , name : & str , value : Option < & str > ) -> CfgResult ;
67
70
}
68
71
69
- pub ( super ) enum CfgResult {
72
+ /// Results of a [`CfgEvaluator`]
73
+ pub enum CfgResult {
74
+ /// cfg option is enabled
70
75
True ,
76
+ /// cfg option is disabled
71
77
False ,
72
- Undetermined { msg : String } ,
78
+ /// cfg option is not enabled or disabled
79
+ Undetermined {
80
+ /// Custom message explaining why the cfg option is undetermined
81
+ msg : String ,
82
+ } ,
73
83
}
74
84
75
85
/// Results of code generation.
0 commit comments