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<'_> {
165
165
pub fn detach ( self ) -> ObjectDetached {
166
166
self . into ( )
167
167
}
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
+ }
168
175
}
Original file line number Diff line number Diff line change @@ -35,6 +35,13 @@ impl<'repo> Commit<'repo> {
35
35
pub fn detach ( self ) -> ObjectDetached {
36
36
self . into ( )
37
37
}
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
+ }
38
45
}
39
46
40
47
impl < ' repo > Commit < ' repo > {
Original file line number Diff line number Diff line change @@ -40,4 +40,11 @@ impl Tag<'_> {
40
40
pub fn detach ( self ) -> ObjectDetached {
41
41
self . into ( )
42
42
}
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
+ }
43
50
}
Original file line number Diff line number Diff line change @@ -266,4 +266,11 @@ impl Tree<'_> {
266
266
pub fn detach ( self ) -> ObjectDetached {
267
267
self . into ( )
268
268
}
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
+ }
269
276
}
You can’t perform that action at this time.
0 commit comments