Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing Debug implementations. #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- rust_version: nightly
run_tests: true
# Minimal supported rustc version
- rust_version: 1.46.0
- rust_version: 1.47.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change to MSRV?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deriving Debug for fixed-sized arrays needs 1.47.

Copy link
Contributor Author

@reitermarkus reitermarkus Nov 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically the big [u8; 448] array in BootSector.

run_tests: false
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.rust_version == 'nightly' }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Rust FAT FS
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
[![crates.io](https://img.shields.io/crates/v/fatfs)](https://crates.io/crates/fatfs)
[![Documentation](https://docs.rs/fatfs/badge.svg)](https://docs.rs/fatfs)
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.46+-yellow.svg)](https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html)
[![Minimum rustc version](https://img.shields.io/badge/rustc-1.47+-yellow.svg)](https://blog.rust-lang.org/2020/10/08/Rust-1.47.html)

A FAT filesystem library implemented in Rust.

Expand Down
1 change: 1 addition & 0 deletions src/boot_sector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ impl BiosParameterBlock {
}
}

#[derive(Debug, Clone)]
pub(crate) struct BootSector {
bootjmp: [u8; 3],
oem_name: [u8; 8],
Expand Down
3 changes: 3 additions & 0 deletions src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::time::TimeProvider;

const LFN_PADDING: u16 = 0xFFFF;

#[derive(Debug)]
pub(crate) enum DirRawStream<'a, IO: ReadWriteSeek, TP, OCC> {
File(File<'a, IO, TP, OCC>),
Root(DiskSlice<FsIoAdapter<'a, IO, TP, OCC>, FsIoAdapter<'a, IO, TP, OCC>>),
Expand Down Expand Up @@ -105,6 +106,7 @@ enum DirEntryOrShortName<'a, IO: ReadWriteSeek, TP, OCC> {
///
/// This struct is created by the `open_dir` or `create_dir` methods on `Dir`.
/// The root directory is returned by the `root_dir` method on `FileSystem`.
#[derive(Debug)]
pub struct Dir<'a, IO: ReadWriteSeek, TP, OCC> {
stream: DirRawStream<'a, IO, TP, OCC>,
fs: &'a FileSystem<IO, TP, OCC>,
Expand Down Expand Up @@ -581,6 +583,7 @@ impl<IO: ReadWriteSeek, TP: TimeProvider, OCC: OemCpConverter> Clone for Dir<'_,
/// An iterator over the directory entries.
///
/// This struct is created by the `iter` method on `Dir`.
#[derive(Debug)]
pub struct DirIter<'a, IO: ReadWriteSeek, TP, OCC> {
stream: DirRawStream<'a, IO, TP, OCC>,
fs: &'a FileSystem<IO, TP, OCC>,
Expand Down
1 change: 1 addition & 0 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const MAX_FILE_SIZE: u32 = core::u32::MAX;
/// A FAT filesystem file object used for reading and writing data.
///
/// This struct is created by the `open_file` or `create_file` methods on `Dir`.
#[derive(Debug)]
pub struct File<'a, IO: ReadWriteSeek, TP, OCC> {
// Note first_cluster is None if file is empty
first_cluster: Option<u32>,
Expand Down
3 changes: 3 additions & 0 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ impl FileSystemStats {
/// A FAT filesystem object.
///
/// `FileSystem` struct is representing a state of a mounted FAT volume.
#[derive(Debug)]
pub struct FileSystem<IO: ReadWriteSeek, TP, OCC> {
pub(crate) disk: RefCell<IO>,
pub(crate) options: FsOptions<TP, OCC>,
Expand Down Expand Up @@ -690,6 +691,7 @@ impl<IO: ReadWriteSeek, TP, OCC> Drop for FileSystem<IO, TP, OCC> {
}
}

#[derive(Debug)]
pub(crate) struct FsIoAdapter<'a, IO: ReadWriteSeek, TP, OCC> {
fs: &'a FileSystem<IO, TP, OCC>,
}
Expand Down Expand Up @@ -747,6 +749,7 @@ fn fat_slice<S: ReadWriteSeek, B: BorrowMut<S>>(
DiskSlice::from_sectors(fat_first_sector, sectors_per_fat, mirrors, bpb, io)
}

#[derive(Debug)]
pub(crate) struct DiskSlice<B, S = B> {
begin: u64,
size: u64,
Expand Down
1 change: 1 addition & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ impl From<std::io::SeekFrom> for SeekFrom {
/// `Read`, `Write`, `Seek` traits from this crate are implemented for this type if
/// corresponding types from `std::io` are implemented by the inner instance.
#[cfg(feature = "std")]
#[derive(Debug)]
pub struct StdIoWrapper<T> {
inner: T,
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
// Disable warnings to not clutter code with cfg too much
#![cfg_attr(not(all(feature = "alloc", feature = "lfn")), allow(dead_code, unused_imports))]
#![deny(missing_debug_implementations)]
#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions, clippy::cast_possible_truncation)]

Expand Down