@@ -11,6 +11,7 @@ When `BorrowMut` is derived for a newtype or struct with one field, a single
1111implementation is generated to expose the underlying field.
1212
1313``` rust
14+ # use core :: borrow :: BorrowMut ;
1415# #[macro_use] extern crate derive_more;
1516# fn main (){}
1617#[derive(BorrowMut )]
@@ -20,6 +21,7 @@ struct MyWrapper(String);
2021Generates:
2122
2223``` rust
24+ # use core :: borrow :: BorrowMut ;
2325# struct MyWrapper (String );
2426impl BorrowMut <String > for MyWrapper {
2527 fn borrow_mut (& mut self ) -> & mut String {
@@ -33,6 +35,7 @@ to the `borrow_mut` implementation of the field. So here `SigleFieldForward`
3335implements all ` BorrowMut ` for all types that ` Vec<i32> ` implements ` BorrowMut ` for.
3436
3537``` rust
38+ # use core :: borrow :: BorrowMut ;
3639# #[macro_use] extern crate derive_more;
3740#[derive(BorrowMut )]
3841#[borrow_mut(forward)]
@@ -49,13 +52,13 @@ This generates:
4952
5053``` rust
5154# struct SingleFieldForward (Vec <i32 >);
52- impl <__BorrowMutT: ? :: core :: marker :: Sized > :: core :: convert :: BorrowMut <__BorrowMutT> for SingleFieldForward
55+ impl <__BorrowMutT: ? :: core :: marker :: Sized > :: core :: borrow :: BorrowMut <__BorrowMutT> for SingleFieldForward
5356where
54- Vec <i32 >: :: core :: convert :: BorrowMut <__BorrowMutT>,
57+ Vec <i32 >: :: core :: borrow :: BorrowMut <__BorrowMutT>,
5558{
5659 #[inline]
5760 fn borrow_mut (& mut self ) -> & mut __BorrowMutT {
58- <Vec <i32 > as :: core :: convert :: BorrowMut <__BorrowMutT>>:: borrow_mut (& mut self . 0 )
61+ <Vec <i32 > as :: core :: borrow :: BorrowMut <__BorrowMutT>>:: borrow_mut (& mut self . 0 )
5962 }
6063}
6164```
@@ -69,6 +72,7 @@ An implementation will be generated for each indicated field.
6972You can also exclude a specific field by using ` #[borrow_mut(ignore)] ` .
7073
7174``` rust
75+ # use core :: borrow :: BorrowMut ;
7276# #[macro_use] extern crate derive_more;
7377# fn main (){}
7478#[derive(BorrowMut )]
@@ -86,6 +90,7 @@ struct MyWrapper {
8690Generates:
8791
8892```
93+ # use core::borrow::BorrowMut;
8994# struct MyWrapper {
9095# name: String,
9196# num: i32,
@@ -108,6 +113,7 @@ Note that `BorrowMut<T>` may only be implemented once for any given type `T`. Th
108113mark more than one field of the same type with ` #[borrow_mut] ` will result in a compilation error.
109114
110115``` compile_fail
116+ # use core::borrow::BorrowMut;
111117# #[macro_use] extern crate derive_more;
112118# fn main(){}
113119// Error! Conflicting implementations of BorrowMut<String>
0 commit comments