Struct FileTimes

#[must_use = "must be applied to a file via `File::set_times` to have any effect"]
pub struct FileTimes { /* private fields */ }

Timestamps for a file.

This is a specialized version of std::fs::FileTimes for usage with File::set_times. Unlike the standard library version, this type records the timestamps itself, so a future io-uring file implementation can consume them without converting through the standard library type.

Examples

use tokio::fs::FileTimes;

# async fn dox() -> std::io::Result<()> {
let times = FileTimes::new()
    .set_accessed(std::time::SystemTime::now())
    .set_modified(std::time::SystemTime::now());
# Ok(())
# }

Implementations

impl FileTimes

fn new() -> Self

Creates a new empty FileTimes.

Unset timestamps are left unchanged.

fn set_accessed(self, t: SystemTime) -> Self

Sets the last access time.

fn set_modified(self, t: SystemTime) -> Self

Sets the last modification time.

Trait Implementations

impl Clone for FileTimes

fn clone(&self) -> Self

impl Debug for FileTimes

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Default for FileTimes

fn default() -> Self

Auto Trait Implementations

impl Freeze for FileTimes

impl RefUnwindSafe for FileTimes

impl Send for FileTimes

impl Sync for FileTimes

impl Unpin for FileTimes

impl UnsafeUnpin for FileTimes

impl UnwindSafe for FileTimes

Blanket Implementations

impl<T> Any for FileTimes where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for FileTimes where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for FileTimes where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for FileTimes where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for FileTimes

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for FileTimes where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for FileTimes where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for FileTimes where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for FileTimes where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>