pub struct DataRoot { /* private fields */ }Expand description
The data root of a server.
Implementations§
Source§impl DataRoot
impl DataRoot
Sourcepub fn new(dir: &Path) -> StreamResult<Self>
pub fn new(dir: &Path) -> StreamResult<Self>
The data root at dir, which must exist.
pub fn path(&self) -> &Path
Sourcepub fn resolve(&self, relative: &str) -> StreamResult<PathBuf>
pub fn resolve(&self, relative: &str) -> StreamResult<PathBuf>
The existing file or directory relative names under the root (“” is the root).
Sourcepub fn resolve_new(&self, relative: &str) -> StreamResult<PathBuf>
pub fn resolve_new(&self, relative: &str) -> StreamResult<PathBuf>
A path for something new under the root: its folder exists under the root, its name is plain and not hidden, and nothing is there yet (never overwritten).
Sourcepub fn relative(&self, path: &Path) -> String
pub fn relative(&self, path: &Path) -> String
path (under the root) relative to the root, with / separators.
Sourcepub fn list(&self, relative: &str) -> StreamResult<FileList>
pub fn list(&self, relative: &str) -> StreamResult<FileList>
The entries of directory relative: hidden entries and links out of the root left out,
directories first, then by name; at most MAX_LIST_ENTRIES.
Trait Implementations§
Auto Trait Implementations§
impl Forget for DataRoot
impl Freeze for DataRoot
impl Move for DataRoot
impl RefUnwindSafe for DataRoot
impl Send for DataRoot
impl Sync for DataRoot
impl Unpin for DataRoot
impl UnsafeUnpin for DataRoot
impl UnwindSafe for DataRoot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
Converts
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> ⓘ
Converts
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