From 1f2427d3717ad2d488ebaeca320d1a9de2b4be23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Harabie=C5=84?= Date: Thu, 28 Jun 2018 19:16:04 +0200 Subject: [PATCH] Implement the same traits for FsOptions as in current stable release --- src/fs.rs | 7 ++++--- src/time.rs | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/fs.rs b/src/fs.rs index bf0dc63..4508c7e 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -3,6 +3,7 @@ use alloc::String; use core::cell::RefCell; use core::char; use core::cmp; +use core::fmt::Debug; use core::iter::FromIterator; use io; use io::prelude::*; @@ -300,7 +301,7 @@ impl FsInfoSector { /// A FAT filesystem mount options. /// /// Options are specified as an argument for `FileSystem::new` method. -//FIXME: #[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug)] pub struct FsOptions { pub(crate) update_accessed_date: bool, pub(crate) oem_cp_converter: &'static OemCpConverter, @@ -727,12 +728,12 @@ impl<'a, T: ReadWriteSeek> Seek for DiskSlice<'a, T> { /// Provides a custom implementation for a short name encoding/decoding. /// Default implementation changes all non-ASCII characters to the replacement character (U+FFFD). /// `OemCpConverter` is specified by the `oem_cp_converter` property in `FsOptions` struct. -pub trait OemCpConverter { +pub trait OemCpConverter: Debug { fn decode(&self, oem_char: u8) -> char; fn encode(&self, uni_char: char) -> Option; } -#[derive(Clone)] +#[derive(Debug)] pub(crate) struct LossyOemCpConverter { _dummy: (), } diff --git a/src/time.rs b/src/time.rs index 166966d..8046126 100644 --- a/src/time.rs +++ b/src/time.rs @@ -1,3 +1,5 @@ +use core::fmt::Debug; + #[cfg(feature = "chrono")] use chrono; #[cfg(feature = "chrono")] @@ -129,12 +131,12 @@ impl From> for DateTime { /// Default implementation gets time from `chrono` crate if `chrono` feature is enabled. /// Otherwise default implementation returns DOS minimal date-time (1980/1/1 0:00:00). /// `TimeProvider` is specified by the `time_provider` property in `FsOptions` struct. -pub trait TimeProvider { +pub trait TimeProvider: Debug { fn get_current_date(&self) -> Date; fn get_current_date_time(&self) -> DateTime; } -#[derive(Clone)] +#[derive(Debug)] pub(crate) struct DefaultTimeProvider { _dummy: (), }