pub struct OpenOptionsSync { /* private fields */ }Available on crate feature
std only.Expand description
Options to open a file with blocking path-traversal protection.
This is the sync counterpart to OpenOptions.
Implementations§
Source§impl OpenOptionsSync
impl OpenOptionsSync
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new set of options with every flag disabled, matching
std::fs::OpenOptions::new. Enable at least one access mode (e.g.
read) before calling open.
Sourcepub fn truncate(&mut self, truncate: bool) -> &mut Self
pub fn truncate(&mut self, truncate: bool) -> &mut Self
Set the option for truncating a previous file.
Sourcepub fn create(&mut self, create: bool) -> &mut Self
pub fn create(&mut self, create: bool) -> &mut Self
Set the option to create a new file, or open it if it already exists.
Sourcepub fn create_new(&mut self, create_new: bool) -> &mut Self
pub fn create_new(&mut self, create_new: bool) -> &mut Self
Set the option to create a new file, failing if it already exists.
Sourcepub fn jail(&mut self, root: impl Into<PathBuf>) -> &mut Self
pub fn jail(&mut self, root: impl Into<PathBuf>) -> &mut Self
Confine every opened path to within root.
Sourcepub fn symlinks(&mut self, policy: SymlinkPolicy) -> &mut Self
pub fn symlinks(&mut self, policy: SymlinkPolicy) -> &mut Self
Set how symbolic links are treated within the jail root.
Defaults to SymlinkPolicy::RestrictToRoot. Has no effect unless a
jail root is configured.
Sourcepub fn created_file_permissions(
&mut self,
permissions: CreatedFilePermissions,
) -> &mut Self
pub fn created_file_permissions( &mut self, permissions: CreatedFilePermissions, ) -> &mut Self
Set permissions used when this open operation creates a new file.
Trait Implementations§
Source§impl Clone for OpenOptionsSync
impl Clone for OpenOptionsSync
Source§impl Debug for OpenOptionsSync
impl Debug for OpenOptionsSync
Auto Trait Implementations§
impl Freeze for OpenOptionsSync
impl RefUnwindSafe for OpenOptionsSync
impl Send for OpenOptionsSync
impl Sync for OpenOptionsSync
impl Unpin for OpenOptionsSync
impl UnsafeUnpin for OpenOptionsSync
impl UnwindSafe for OpenOptionsSync
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