File tree 1 file changed +9
-2
lines changed
src/libsyntax_ext/deriving/generic
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1745,8 +1745,15 @@ pub fn cs_fold<F>(use_foldl: bool,
1745
1745
}
1746
1746
}
1747
1747
1748
- /// Special version of `cs_fold` that uses the result of a function call on the first field
1749
- /// as the base case when is at least 1 field, and the usual base case when there are zero fields.
1748
+ /// Function to fold over fields, with three cases, to generate more efficient and concise code.
1749
+ /// When the `substructure` has grouped fields, there are two cases:
1750
+ /// Zero fields: call the base case function with None (like the usual base case of `cs_fold`).
1751
+ /// One or more fields: call the base case function on the first value (which depends on
1752
+ /// `use_fold`), and use that as the base case. Then perform `cs_fold` on the remainder of the
1753
+ /// fields.
1754
+ /// When the `substructure` is a `EnumNonMatchingCollapsed`, the result of `enum_nonmatch_f`
1755
+ /// is returned. Statics may not be folded over.
1756
+ /// See `cs_op` in `partial_ord.rs` for a model example.
1750
1757
pub fn cs_fold1 < F , B > ( use_foldl : bool ,
1751
1758
f : F ,
1752
1759
mut b : B ,
You can’t perform that action at this time.
0 commit comments