@@ -54,7 +54,7 @@ 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
57
+ /// Impl for handling conditional compilation attributes.
58
58
pub cfg_evaluator : Box < dyn CfgEvaluator > ,
59
59
60
60
pub ( super ) gen_header : bool ,
@@ -63,21 +63,23 @@ pub struct Opt {
63
63
pub ( super ) doxygen : bool ,
64
64
}
65
65
66
- /// An evaluator which parses cfg attributes
66
+ /// Logic to decide whether a conditional compilation attribute is enabled or
67
+ /// disabled.
67
68
pub trait CfgEvaluator {
68
- /// For a given cfg name and value return a [`CfgResult`] indicating if it's enabled
69
+ /// A name-only attribute such as `cfg(ident)` is passed with a `value` of
70
+ /// None, while `cfg(key = "value")` is passed with the "value" in `value`.
69
71
fn eval ( & self , name : & str , value : Option < & str > ) -> CfgResult ;
70
72
}
71
73
72
- /// Results of a [`CfgEvaluator`]
74
+ /// Result of a [`CfgEvaluator`] evaluation.
73
75
pub enum CfgResult {
74
- /// cfg option is enabled
76
+ /// Cfg option is enabled.
75
77
True ,
76
- /// cfg option is disabled
78
+ /// Cfg option is disabled.
77
79
False ,
78
- /// cfg option is not enabled or disabled
80
+ /// Cfg option is neither enabled nor disabled.
79
81
Undetermined {
80
- /// Custom message explaining why the cfg option is undetermined
82
+ /// Message explaining why the cfg option is undetermined.
81
83
msg : String ,
82
84
} ,
83
85
}
0 commit comments