Implement the same traits for FsOptions as in current stable release
This commit is contained in:
parent
759758c1f2
commit
1f2427d371
@ -3,6 +3,7 @@ use alloc::String;
|
|||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
use core::char;
|
use core::char;
|
||||||
use core::cmp;
|
use core::cmp;
|
||||||
|
use core::fmt::Debug;
|
||||||
use core::iter::FromIterator;
|
use core::iter::FromIterator;
|
||||||
use io;
|
use io;
|
||||||
use io::prelude::*;
|
use io::prelude::*;
|
||||||
@ -300,7 +301,7 @@ impl FsInfoSector {
|
|||||||
/// A FAT filesystem mount options.
|
/// A FAT filesystem mount options.
|
||||||
///
|
///
|
||||||
/// Options are specified as an argument for `FileSystem::new` method.
|
/// Options are specified as an argument for `FileSystem::new` method.
|
||||||
//FIXME: #[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub struct FsOptions {
|
pub struct FsOptions {
|
||||||
pub(crate) update_accessed_date: bool,
|
pub(crate) update_accessed_date: bool,
|
||||||
pub(crate) oem_cp_converter: &'static OemCpConverter,
|
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.
|
/// Provides a custom implementation for a short name encoding/decoding.
|
||||||
/// Default implementation changes all non-ASCII characters to the replacement character (U+FFFD).
|
/// 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.
|
/// `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 decode(&self, oem_char: u8) -> char;
|
||||||
fn encode(&self, uni_char: char) -> Option<u8>;
|
fn encode(&self, uni_char: char) -> Option<u8>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct LossyOemCpConverter {
|
pub(crate) struct LossyOemCpConverter {
|
||||||
_dummy: (),
|
_dummy: (),
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use core::fmt::Debug;
|
||||||
|
|
||||||
#[cfg(feature = "chrono")]
|
#[cfg(feature = "chrono")]
|
||||||
use chrono;
|
use chrono;
|
||||||
#[cfg(feature = "chrono")]
|
#[cfg(feature = "chrono")]
|
||||||
@ -129,12 +131,12 @@ impl From<chrono::DateTime<Local>> for DateTime {
|
|||||||
/// Default implementation gets time from `chrono` crate if `chrono` feature is enabled.
|
/// 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).
|
/// 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.
|
/// `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(&self) -> Date;
|
||||||
fn get_current_date_time(&self) -> DateTime;
|
fn get_current_date_time(&self) -> DateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct DefaultTimeProvider {
|
pub(crate) struct DefaultTimeProvider {
|
||||||
_dummy: (),
|
_dummy: (),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user