mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
gstreamer: Allow dumping mutable byte slices too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1598>
This commit is contained in:
parent
9596ef8338
commit
09e5130e1e
1 changed files with 14 additions and 0 deletions
|
@ -26,6 +26,20 @@ impl<'a> ByteSliceExt for &'a [u8] {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ByteSliceExt for &'a mut [u8] {
|
||||
fn dump(&self) -> Dump {
|
||||
self.dump_range(..)
|
||||
}
|
||||
|
||||
fn dump_range(&self, range: impl RangeBounds<usize>) -> Dump {
|
||||
Dump {
|
||||
data: self,
|
||||
start: range.start_bound().cloned(),
|
||||
end: range.end_bound().cloned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Dump<'a> {
|
||||
pub(crate) data: &'a [u8],
|
||||
pub(crate) start: Bound<usize>,
|
||||
|
|
Loading…
Reference in a new issue