Skip to main content

FileSeek

Trait FileSeek 

Source
pub trait FileSeek: FileOperation {
    // Required method
    fn file_seek(
        &self,
        file: &Self::File,
        position: SeekFrom,
        cancellation: &Cancellation,
    ) -> impl Future<Output = OperationResult<u64>> + Send;
}
Expand description

Inspect or reposition a file resource’s shared cursor.

Required Methods§

Source

fn file_seek( &self, file: &Self::File, position: SeekFrom, cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<u64>> + Send

Reposition the shared cursor and return its resulting byte offset. SeekFrom::Current(0) queries the position; seeking past EOF does not extend the file. Absolute offsets must fit in i64; invalid positions and OS limits return errors.

Await cursor operations sequentially when ordering matters. A seek followed by a read or write is not atomic with respect to other users of the resource. Cancellation before execution prevents seeking; once started, the actual result is preserved, and dropping the future does not undo the seek.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§