pub trait OpenOptionsExt {
// Required methods
fn try_open_shared(&self, path: &Path) -> Result<Option<LockedFile>>;
fn open_shared(
&self,
path: &Path,
) -> impl Future<Output = Result<LockedFile>> + Send;
fn try_open_exclusive(&self, path: &Path) -> Result<Option<LockedFile>>;
fn open_exclusive(
&self,
path: &Path,
) -> impl Future<Output = Result<LockedFile>> + Send;
}Expand description
An extension trait for OpenOptions.
When the file_lock Rust feature stabilizes, this implementation will be
removed.
Required Methods§
Attempts to open a file with a shared lock.
Returns the locked file upon success.
If the lock cannot be immediately acquired, Ok(None) is returned.
Attempts to open a file with a shared lock.
Returns the locked file upon success.
Sourcefn try_open_exclusive(&self, path: &Path) -> Result<Option<LockedFile>>
fn try_open_exclusive(&self, path: &Path) -> Result<Option<LockedFile>>
Attempts to open a file with an exclusive lock.
Returns the locked file upon success.
If the lock cannot be immediately acquired, Ok(None) is returned.
Sourcefn open_exclusive(
&self,
path: &Path,
) -> impl Future<Output = Result<LockedFile>> + Send
fn open_exclusive( &self, path: &Path, ) -> impl Future<Output = Result<LockedFile>> + Send
Attempts to open a file with an exclusive lock.
Returns the locked file upon success.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.