pub struct OpenModeFlag(/* private fields */);
Expand description

This enum is used with open() to describe the mode in which a device is opened. It is also returned by openMode().

C++ enum: QIODevice::OpenModeFlag.

C++ documentation:

This enum is used with open() to describe the mode in which a device is opened. It is also returned by openMode().

Certain flags, such as Unbuffered and Truncate, are meaningless when used with some subclasses. Some of these restrictions are implied by the type of device that is represented by a subclass. In other cases, the restriction may be due to the implementation, or may be imposed by the underlying platform; for example, QTcpSocket does not support Unbuffered mode, and limitations in the native API prevent QFile from supporting Unbuffered on Windows.

The OpenMode type is a typedef for QFlags<OpenModeFlag>. It stores an OR combination of OpenModeFlag values.

Implementations§

source§

impl OpenModeFlag

source

pub fn to_int(&self) -> c_int

source§

impl OpenModeFlag

source

pub const NotOpen: OpenModeFlag = _

The device is not open. (C++ enum variant: NotOpen = 0)

source

pub const ReadOnly: OpenModeFlag = _

The device is open for reading. (C++ enum variant: ReadOnly = 1)

source

pub const WriteOnly: OpenModeFlag = _

The device is open for writing. Note that this mode implies Truncate. (C++ enum variant: WriteOnly = 2)

source

pub const ReadWrite: OpenModeFlag = _

The device is open for reading and writing. (C++ enum variant: ReadWrite = 3)

source

pub const Append: OpenModeFlag = _

The device is opened in append mode so that all data is written to the end of the file. (C++ enum variant: Append = 4)

source

pub const Truncate: OpenModeFlag = _

If possible, the device is truncated before it is opened. All earlier contents of the device are lost. (C++ enum variant: Truncate = 8)

source

pub const Text: OpenModeFlag = _

When reading, the end-of-line terminators are translated to ‘\n’. When writing, the end-of-line terminators are translated to the local encoding, for example ‘\r\n’ for Win32. (C++ enum variant: Text = 16)

source

pub const Unbuffered: OpenModeFlag = _

Any buffer in the device is bypassed. (C++ enum variant: Unbuffered = 32)

source

pub const NewOnly: OpenModeFlag = _

Fail if the file to be opened already exists. Create and open the file only if it does not exist. There is a guarantee from the operating system that you are the only one creating and opening the file. Note that this mode implies WriteOnly, and combining it with ReadWrite is allowed. This flag currently only affects QFile. Other classes might use this flag in the future, but until then using this flag with any classes other than QFile may result in undefined behavior. (C++ enum variant: NewOnly = 64)

source

pub const ExistingOnly: OpenModeFlag = _

Fail if the file to be opened does not exist. This flag must be specified alongside ReadOnly, WriteOnly, or ReadWrite. Note that using this flag with ReadOnly alone is redundant, as ReadOnly already fails when the file does not exist. This flag currently only affects QFile. Other classes might use this flag in the future, but until then using this flag with any classes other than QFile may result in undefined behavior. (C++ enum variant: ExistingOnly = 128)

Trait Implementations§

source§

impl<T: Into<QFlags<OpenModeFlag>>> BitOr<T> for OpenModeFlag

§

type Output = QFlags<OpenModeFlag>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: T) -> QFlags<OpenModeFlag>

Performs the | operation. Read more
source§

impl Clone for OpenModeFlag

source§

fn clone(&self) -> OpenModeFlag

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for OpenModeFlag

source§

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

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

impl From<OpenModeFlag> for QFlags<OpenModeFlag>

source§

fn from(value: OpenModeFlag) -> Self

Converts to this type from the input type.
source§

impl From<OpenModeFlag> for c_int

source§

fn from(value: OpenModeFlag) -> Self

Converts to this type from the input type.
source§

impl From<i32> for OpenModeFlag

source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
source§

impl PartialEq for OpenModeFlag

source§

fn eq(&self, other: &OpenModeFlag) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for OpenModeFlag

source§

impl Eq for OpenModeFlag

source§

impl StructuralEq for OpenModeFlag

source§

impl StructuralPartialEq for OpenModeFlag

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. 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 T
where 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> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.