removed generic from FatFs, made inner a dyn now

This commit is contained in:
Moritz Gmeiner 2025-07-27 23:16:56 +02:00
commit a08a84c3e4
7 changed files with 270 additions and 78 deletions

View file

@ -1,17 +1,17 @@
use std::io::Read;
use crate::FatFs;
use crate::subslice::SubSlice;
use crate::utils::replace;
use crate::{FatFs, SliceLike};
pub struct ClusterChainReader<'a, S: SliceLike> {
sub_slice: SubSlice<'a, S>,
pub struct ClusterChainReader<'a> {
sub_slice: SubSlice<'a>,
next_cluster: Option<u32>,
}
impl<'a, S: SliceLike> ClusterChainReader<'a, S> {
pub fn new(fat_fs: &'a FatFs<S>, first_cluster: u32) -> ClusterChainReader<'a, S> {
impl<'a> ClusterChainReader<'a> {
pub fn new(fat_fs: &'a FatFs, first_cluster: u32) -> ClusterChainReader<'a> {
let next_cluster = fat_fs.next_cluster(first_cluster).unwrap_or(None);
let sub_slice = fat_fs.cluster_as_subslice(first_cluster);
@ -39,7 +39,7 @@ impl<'a, S: SliceLike> ClusterChainReader<'a, S> {
}
}
impl<'a, S: SliceLike> Read for ClusterChainReader<'a, S> {
impl<'a> Read for ClusterChainReader<'a> {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
if self.sub_slice.is_empty() {
if !self.next_cluster() {