pub struct ServedFolder(/* private fields */);Expand description
The canonical folder devpage serves from, the boundary around it, and the
prefix its addresses are under — its mount: empty for a local devpage
and bundled mode, /d/<id> or /d/<id>/v/<n> for a version in server
mode. It is made once, where devpage starts serving a folder, and passed
to everything loaded from it, so the mount reaches every address.
Implementations§
Source§impl ServedFolder
impl ServedFolder
Sourcepub fn new(path: &Path) -> Result<Self>
pub fn new(path: &Path) -> Result<Self>
The served folder at path, made canonical; an error when it doesn’t
exist.
Sourcepub fn canonical(path: PathBuf) -> Self
pub fn canonical(path: PathBuf) -> Self
A served folder at a path the caller already made canonical, at /.
Sourcepub fn mounted(self, mount: &str) -> Self
pub fn mounted(self, mount: &str) -> Self
The same folder with its addresses under mount, which starts with
/ and doesn’t end with one: /d/<id>/v/<n>.
Sourcepub fn inside(&self, path: &Path) -> Option<PathBuf>
pub fn inside(&self, path: &Path) -> Option<PathBuf>
path with symbolic links followed, when it exists inside the folder.
Sourcepub fn file(&self, path: &Path) -> Option<PathBuf>
pub fn file(&self, path: &Path) -> Option<PathBuf>
path resolved, when it is a file inside the folder.
Sourcepub fn folder(&self, path: &Path) -> Option<PathBuf>
pub fn folder(&self, path: &Path) -> Option<PathBuf>
path resolved, when it is a folder inside the folder.
Sourcepub fn named(&self, path: &Path) -> Option<PathBuf>
pub fn named(&self, path: &Path) -> Option<PathBuf>
The file path names, as the watcher reports it: resolved, when it
is a file inside the folder; when nothing is there yet, the path it
would have — its folder resolved on disk where that folder exists —
so its arrival can be told apart. None for anything else: a path
outside the folder, or a folder.
Sourcepub fn at(&self, url_path: &str) -> Option<PathBuf>
pub fn at(&self, url_path: &str) -> Option<PathBuf>
What a URL path names — any entry, file or folder — when it lies inside the folder.
Sourcepub fn file_at(&self, url_path: &str) -> Option<PathBuf>
pub fn file_at(&self, url_path: &str) -> Option<PathBuf>
The file a URL path names, when it is a file inside the folder.
Sourcepub fn contains(&self, path: &Path) -> bool
pub fn contains(&self, path: &Path) -> bool
Whether an already-resolved path lies inside the folder, without touching the disk: for paths that may no longer exist, such as a deleted file the watcher reports.
Sourcepub fn relative<'a>(&self, path: &'a Path) -> Option<&'a Path>
pub fn relative<'a>(&self, path: &'a Path) -> Option<&'a Path>
A resolved path’s place in the folder, None when it lies outside.
Trait Implementations§
Source§impl AsRef<Path> for ServedFolder
impl AsRef<Path> for ServedFolder
Source§impl Clone for ServedFolder
impl Clone for ServedFolder
Source§impl Debug for ServedFolder
impl Debug for ServedFolder
Source§impl Default for ServedFolder
impl Default for ServedFolder
impl Eq for ServedFolder
Source§impl PartialEq for ServedFolder
impl PartialEq for ServedFolder
impl StructuralPartialEq for ServedFolder
Auto Trait Implementations§
impl Freeze for ServedFolder
impl RefUnwindSafe for ServedFolder
impl Send for ServedFolder
impl Sync for ServedFolder
impl Unpin for ServedFolder
impl UnsafeUnpin for ServedFolder
impl UnwindSafe for ServedFolder
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
impl<T> Brush for 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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Fruit for T
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> ⓘ
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