Struct std::sys::windows::fs::File

source ·
pub struct File {
    handle: Handle,
}

Fields§

§handle: Handle

Implementations§

source§

impl File

source

pub fn open(path: &Path, opts: &OpenOptions) -> Result<File>

source

pub fn fsync(&self) -> Result<()>

source

pub fn datasync(&self) -> Result<()>

source

pub fn truncate(&self, size: u64) -> Result<()>

source

pub fn file_attr(&self) -> Result<FileAttr>

source

pub fn read(&self, buf: &mut [u8]) -> Result<usize>

source

pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>

source

pub fn is_read_vectored(&self) -> bool

source

pub fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>

source

pub fn read_buf(&self, cursor: BorrowedCursor<'_>) -> Result<()>

source

pub fn write(&self, buf: &[u8]) -> Result<usize>

source

pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize>

source

pub fn is_write_vectored(&self) -> bool

source

pub fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize>

source

pub fn flush(&self) -> Result<()>

source

pub fn seek(&self, pos: SeekFrom) -> Result<u64>

source

pub fn duplicate(&self) -> Result<File>

source

fn reparse_point( &self, space: &mut Align8<[MaybeUninit<u8>]> ) -> Result<(c_ulong, *mut REPARSE_DATA_BUFFER)>

source

pub fn set_permissions(&self, perm: FilePermissions) -> Result<()>

source

pub fn set_times(&self, times: FileTimes) -> Result<()>

source

fn basic_info(&self) -> Result<FILE_BASIC_INFO>

Get only basic file information such as attributes and file times.

source

fn posix_delete(&self) -> Result<()>

Delete using POSIX semantics.

Files will be deleted as soon as the handle is closed. This is supported for Windows 10 1607 (aka RS1) and later. However some filesystem drivers will not support it even then, e.g. FAT32.

If the operation is not supported for this filesystem or OS version then errors will be ERROR_NOT_SUPPORTED or ERROR_INVALID_PARAMETER.

source

fn win32_delete(&self) -> Result<()>

Delete a file using win32 semantics. The file won’t actually be deleted until all file handles are closed. However, marking a file for deletion will prevent anyone from opening a new handle to the file.

source

fn fill_dir_buff(&self, buffer: &mut DirBuff, restart: bool) -> Result<bool>

Fill the given buffer with as many directory entries as will fit. This will remember its position and continue from the last call unless restart is set to true.

The returned bool indicates if there are more entries or not. It is an error if self is not a directory.

On Windows a file is either a directory or a non-directory. A symlink directory is simply an empty directory with some “reparse” metadata attached. So if you open a link (not its target) and iterate the directory, you will always iterate an empty directory regardless of the target.

Trait Implementations§

source§

impl AsHandle for File

source§

fn as_handle(&self) -> BorrowedHandle<'_>

Available on Windows only.
Borrows the handle. Read more
source§

impl AsRawHandle for File

source§

fn as_raw_handle(&self) -> RawHandle

Available on Windows only.
Extracts the raw handle. Read more
source§

impl Debug for File

source§

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

Formats the value using the given formatter. Read more
source§

impl From<File> for Stdio

source§

fn from(file: File) -> Stdio

Converts to this type from the input type.
source§

impl FromRawHandle for File

source§

unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self

Available on Windows only.
Constructs a new I/O object from the specified raw handle. Read more
source§

impl IntoRawHandle for File

source§

fn into_raw_handle(self) -> RawHandle

Available on Windows only.
Consumes this object, returning the raw underlying handle. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for File

§

impl Send for File

§

impl Sync for File

§

impl Unpin for File

§

impl UnwindSafe for File

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.