mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-28 20:41:31 +00:00
gstreamer: Allow dumping mutable byte slices too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1596>
This commit is contained in:
parent
9c386085e3
commit
5b652aa3d0
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 struct Dump<'a> {
|
||||||
pub(crate) data: &'a [u8],
|
pub(crate) data: &'a [u8],
|
||||||
pub(crate) start: Bound<usize>,
|
pub(crate) start: Bound<usize>,
|
||||||
|
|
Loading…
Reference in a new issue