File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1727,7 +1727,6 @@ fn generate_node(
1727
1727
] )
1728
1728
} ) ,
1729
1729
BlankLine ,
1730
- Line ( "#[derive(Clone, Copy)]" . to_string( ) ) ,
1731
1730
( if !is_generic {
1732
1731
Line ( "pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> }" . to_string( ) )
1733
1732
} else {
@@ -1740,6 +1739,15 @@ fn generate_node(
1740
1739
Line ( "}" . to_string( ) )
1741
1740
] )
1742
1741
} ) ,
1742
+ // Manually implement Copy/Clone because `derive` only kicks in if all of
1743
+ // the parameters are known to implement Copy/Clone.
1744
+ Branch ( vec![
1745
+ Line ( format!( "impl <'a,{0}> ::core::marker::Copy for Reader<'a,{0}> {1} {{}}" ,
1746
+ params. params, params. where_clause) ) ,
1747
+ Line ( format!( "impl <'a,{0}> ::core::clone::Clone for Reader<'a,{0}> {1} {{" ,
1748
+ params. params, params. where_clause) ) ,
1749
+ Indent ( Box :: new( Line ( "fn clone(&self) -> Self { *self }" . into( ) ) ) ) ,
1750
+ Line ( "}" . into( ) ) ] ) ,
1743
1751
BlankLine ,
1744
1752
Branch ( vec![
1745
1753
Line ( format!( "impl <'a,{0}> ::capnp::traits::HasTypeId for Reader<'a,{0}> {1} {{" ,
You can’t perform that action at this time.
0 commit comments