[][src]Struct agilulf_fs::File

pub struct File { /* fields omitted */ }

A struct contains only one fd.

As the constant style of Linux system call, aio accepts fd. And I cannot get a fd from std::fs::File.

This example is not tested
pub struct File {
   fd: RawFd,
}

WARNING

  1. This struct will close the fd automatically when it's dropped.

  2. Open file with this struct will take over the SIGIO signal. AIO will send a SIGIO signal with request id to this process and then this library will lookup WAKER_LIST and find the waker corresponding to this id. Then it will wake that task.

Methods

impl File[src]

pub fn open(path: &str) -> Result<Self>[src]

Open file from given path.

The oflag in this function is set as O_RDWR | O_CREAT. And the mode is set as S_IRUSR|S_IWUSR. While opening the first file, it will take over the SIGIO signal (by set it's handler).

Important traits for WriteFile<'a>
pub fn write<'a>(&self, offset: i64, buf: &'a [u8]) -> WriteFile<'a>[src]

Write buffer into file with aio.

pub fn fallocate(&self, offset: i64, len: i64) -> Result<()>[src]

fallocate the file.

Trait Implementations

impl Drop for File[src]

Auto Trait Implementations

impl Unpin for File

impl Sync for File

impl Send for File

impl RefUnwindSafe for File

impl UnwindSafe for File

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,