Struct OpenOptions
pub struct OpenOptions { /* private fields */ }std only.Expand description
Options to open a file with async path-traversal protection.
Mirrors the access-mode setters of [tokio::fs::OpenOptions]
(read/write/append/truncate/create/create_new) and adds
jail to confine every opened path to a trusted root
directory.
Implementations§
§impl OpenOptions
impl OpenOptions
pub fn new() -> OpenOptions
Available on crate features grpc and http only.
pub fn new() -> OpenOptions
grpc and http only.pub fn read(&mut self, read: bool) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn read(&mut self, read: bool) -> &mut OpenOptions
grpc and http only.Set the option for read access.
pub fn write(&mut self, write: bool) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn write(&mut self, write: bool) -> &mut OpenOptions
grpc and http only.Set the option for write access.
pub fn append(&mut self, append: bool) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn append(&mut self, append: bool) -> &mut OpenOptions
grpc and http only.Set the option for append mode.
pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn truncate(&mut self, truncate: bool) -> &mut OpenOptions
grpc and http only.Set the option for truncating a previous file.
pub fn create(&mut self, create: bool) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn create(&mut self, create: bool) -> &mut OpenOptions
grpc and http only.Set the option to create a new file, or open it if it already exists.
pub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn create_new(&mut self, create_new: bool) -> &mut OpenOptions
grpc and http only.Set the option to create a new file, failing if it already exists.
pub fn jail(&mut self, root: impl Into<PathBuf>) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn jail(&mut self, root: impl Into<PathBuf>) -> &mut OpenOptions
grpc and http only.Confine every opened path to within root.
The path passed to open is then interpreted as relative
to root; absolute paths are rejected, and the resolved path must remain
within root or the open fails with UnsafePathError::EscapesRoot.
root must exist when opening.
pub fn symlinks(&mut self, policy: SymlinkPolicy) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn symlinks(&mut self, policy: SymlinkPolicy) -> &mut OpenOptions
grpc and http only.Set how symbolic links are treated within the jail root.
Defaults to SymlinkPolicy::RestrictToRoot. Has no effect unless a
jail root is configured.
pub fn created_file_permissions(
&mut self,
permissions: CreatedFilePermissions,
) -> &mut OpenOptions
Available on crate features grpc and http only.
pub fn created_file_permissions( &mut self, permissions: CreatedFilePermissions, ) -> &mut OpenOptions
grpc and http only.Set permissions used when this open operation creates a new file.
Trait Implementations§
§impl Clone for OpenOptions
impl Clone for OpenOptions
§fn clone(&self) -> OpenOptions
fn clone(&self) -> OpenOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for OpenOptions
impl Debug for OpenOptions
§impl Default for OpenOptions
impl Default for OpenOptions
§fn default() -> OpenOptions
fn default() -> OpenOptions
Auto Trait Implementations§
impl Freeze for OpenOptions
impl RefUnwindSafe for OpenOptions
impl Send for OpenOptions
impl Sync for OpenOptions
impl Unpin for OpenOptions
impl UnsafeUnpin for OpenOptions
impl UnwindSafe for OpenOptions
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>
§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writer§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writer§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writer§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writer§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer