SubSlice(Mut): custom Debug implementation

This commit is contained in:
Moritz Gmeiner 2025-07-26 16:48:02 +02:00
commit b96805c1c4

View file

@ -1,3 +1,4 @@
use std::fmt::Debug;
use std::io::{Read, Write}; use std::io::{Read, Write};
use crate::{FatFs, SliceLike}; use crate::{FatFs, SliceLike};
@ -9,6 +10,15 @@ pub struct SubSliceMut<'a, S: SliceLike> {
len: usize, len: usize,
} }
impl<S: SliceLike> Debug for SubSliceMut<'_, S> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("SubSliceMut")
.field("offset", &self.offset)
.field("len", &self.len)
.finish()
}
}
impl<S: SliceLike> SubSliceMut<'_, S> { impl<S: SliceLike> SubSliceMut<'_, S> {
pub fn new(fat_fs: &mut FatFs<S>, offset: u64, len: usize) -> SubSliceMut<'_, S> { pub fn new(fat_fs: &mut FatFs<S>, offset: u64, len: usize) -> SubSliceMut<'_, S> {
SubSliceMut { SubSliceMut {
@ -70,6 +80,15 @@ pub struct SubSlice<'a, S: SliceLike> {
len: usize, len: usize,
} }
impl<S: SliceLike> Debug for SubSlice<'_, S> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("SubSliceMut")
.field("offset", &self.offset)
.field("len", &self.len)
.finish()
}
}
impl<S: SliceLike> SubSlice<'_, S> { impl<S: SliceLike> SubSlice<'_, S> {
pub fn new(fat_fs: &mut FatFs<S>, offset: u64, len: usize) -> SubSlice<'_, S> { pub fn new(fat_fs: &mut FatFs<S>, offset: u64, len: usize) -> SubSlice<'_, S> {
SubSlice { SubSlice {