File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed
Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -165,4 +165,11 @@ impl Blob<'_> {
165165 pub fn detach ( self ) -> ObjectDetached {
166166 self . into ( )
167167 }
168+
169+ /// Retrieve this instance's data, leaving its own data empty.
170+ ///
171+ /// This method works around the immovability of members of this type.
172+ pub fn take_data ( & mut self ) -> Vec < u8 > {
173+ std:: mem:: take ( & mut self . data )
174+ }
168175}
Original file line number Diff line number Diff line change @@ -35,6 +35,13 @@ impl<'repo> Commit<'repo> {
3535 pub fn detach ( self ) -> ObjectDetached {
3636 self . into ( )
3737 }
38+
39+ /// Retrieve this instance's encoded data, leaving its own data empty.
40+ ///
41+ /// This method works around the immovability of members of this type.
42+ pub fn take_data ( & mut self ) -> Vec < u8 > {
43+ std:: mem:: take ( & mut self . data )
44+ }
3845}
3946
4047impl < ' repo > Commit < ' repo > {
Original file line number Diff line number Diff line change @@ -40,4 +40,11 @@ impl Tag<'_> {
4040 pub fn detach ( self ) -> ObjectDetached {
4141 self . into ( )
4242 }
43+
44+ /// Retrieve this instance's encoded data, leaving its own data empty.
45+ ///
46+ /// This method works around the immovability of members of this type.
47+ pub fn take_data ( & mut self ) -> Vec < u8 > {
48+ std:: mem:: take ( & mut self . data )
49+ }
4350}
Original file line number Diff line number Diff line change @@ -266,4 +266,11 @@ impl Tree<'_> {
266266 pub fn detach ( self ) -> ObjectDetached {
267267 self . into ( )
268268 }
269+
270+ /// Retrieve this instance's encoded data, leaving its own data empty.
271+ ///
272+ /// This method works around the immovability of members of this type.
273+ pub fn take_data ( & mut self ) -> Vec < u8 > {
274+ std:: mem:: take ( & mut self . data )
275+ }
269276}
You can’t perform that action at this time.
0 commit comments