Skip to main content

FileExt

Trait FileExt 

Source
pub trait FileExt: Send {
    // Required methods
    fn create_new_if_not_exists(
        path: impl AsRef<Path> + Send,
    ) -> impl Future<Output = Result<Option<Self>>> + Send
       where Self: Sized;
    fn create_if_not_exists(
        path: impl AsRef<Path> + Send,
    ) -> impl Future<Output = Result<Option<Self>>> + Send
       where Self: Sized;
    fn open_if_exists(
        path: impl AsRef<Path> + Send,
    ) -> impl Future<Output = Result<Option<Self>>> + Send
       where Self: Sized;
    fn with_permissions(
        &self,
        perm: Permissions,
    ) -> impl Future<Output = Result<&Self>> + Send;
    fn with_permissions_readonly(
        &self,
        readonly: bool,
    ) -> impl Future<Output = Result<&Self>> + Send;
    fn with_permissions_mode(
        &self,
        mode: u32,
    ) -> impl Future<Output = Result<&Self>> + Send;
    fn add_permissions_mode(
        &self,
        mode: u32,
    ) -> impl Future<Output = Result<&Self>> + Send;
    fn remove_permissions_mode(
        &self,
        mode: u32,
    ) -> impl Future<Output = Result<&Self>> + Send;
    fn chown(
        &self,
        uid: Option<u32>,
        gid: Option<u32>,
    ) -> impl Future<Output = Result<&Self>> + Send;
}
Available on crate feature tokio only.

Required Methods§

Source

fn create_new_if_not_exists( path: impl AsRef<Path> + Send, ) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized,

Source

fn create_if_not_exists( path: impl AsRef<Path> + Send, ) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized,

Source

fn open_if_exists( path: impl AsRef<Path> + Send, ) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized,

Source

fn with_permissions( &self, perm: Permissions, ) -> impl Future<Output = Result<&Self>> + Send

Source

fn with_permissions_readonly( &self, readonly: bool, ) -> impl Future<Output = Result<&Self>> + Send

Source

fn with_permissions_mode( &self, mode: u32, ) -> impl Future<Output = Result<&Self>> + Send

Available on Unix only.
Source

fn add_permissions_mode( &self, mode: u32, ) -> impl Future<Output = Result<&Self>> + Send

Available on Unix only.
Source

fn remove_permissions_mode( &self, mode: u32, ) -> impl Future<Output = Result<&Self>> + Send

Available on Unix only.
Source

fn chown( &self, uid: Option<u32>, gid: Option<u32>, ) -> impl Future<Output = Result<&Self>> + Send

Available on Unix only.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FileExt for File

Source§

async fn create_new_if_not_exists( path: impl AsRef<Path> + Send, ) -> Result<Option<Self>>

Source§

async fn create_if_not_exists( path: impl AsRef<Path> + Send, ) -> Result<Option<Self>>

Source§

async fn open_if_exists(path: impl AsRef<Path> + Send) -> Result<Option<Self>>

Source§

async fn with_permissions(&self, perm: Permissions) -> Result<&Self>

Source§

async fn with_permissions_readonly(&self, readonly: bool) -> Result<&Self>

Source§

async fn with_permissions_mode(&self, mode: u32) -> Result<&Self>

Available on Unix only.
Source§

async fn add_permissions_mode(&self, mode: u32) -> Result<&Self>

Available on Unix only.
Source§

async fn remove_permissions_mode(&self, mode: u32) -> Result<&Self>

Available on Unix only.
Source§

async fn chown(&self, uid: Option<u32>, gid: Option<u32>) -> Result<&Self>

Available on Unix only.

Implementors§