#[non_exhaustive]pub enum Disposition {
CreateNew,
OpenExisting,
OpenAlways,
}Expand description
The disposition of an open: what it does when the file exists and when it does not.
None of the three changes the contents of a file that exists, so no data access is gated by the choice.
| Variant | dwCreationDisposition | File exists | File does not exist |
|---|---|---|---|
CreateNew | CREATE_NEW | fails, ERROR_FILE_EXISTS | created |
OpenExisting | OPEN_EXISTING | opened | fails, ERROR_FILE_NOT_FOUND |
OpenAlways | OPEN_ALWAYS | opened | created |
A file that an open creates is created empty.
There is deliberately no Default: the options start at OpenExisting,
which creates nothing, and a disposition is stated where one is wanted.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
CreateNew
CREATE_NEW: create the file, and fail if it exists.
OpenExisting
OPEN_EXISTING: open the file, and fail if it does not exist.
OpenAlways
OPEN_ALWAYS: open the file if it exists, and create it if it does not.
Trait Implementations§
Source§impl Clone for Disposition
impl Clone for Disposition
impl Copy for Disposition
Source§impl Debug for Disposition
impl Debug for Disposition
impl Eq for Disposition
Source§impl Hash for Disposition
impl Hash for Disposition
Source§impl PartialEq for Disposition
impl PartialEq for Disposition
impl StructuralPartialEq for Disposition
Auto Trait Implementations§
impl Freeze for Disposition
impl RefUnwindSafe for Disposition
impl Send for Disposition
impl Sync for Disposition
impl Unpin for Disposition
impl UnsafeUnpin for Disposition
impl UnwindSafe for Disposition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more