pub struct Snapshot { /* private fields */ }Expand description
The files a module is made from, each read once: the module and every module its relative imports reach inside the served folder. Its version and its compiled bytes both come from one snapshot, so a save landing between the two can’t serve new bytes under the old version.
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn served(&self) -> &ServedFolder
pub fn served(&self) -> &ServedFolder
The served folder the snapshot was read in.
Sourcepub fn closure(&self, file: &Path) -> Vec<(PathBuf, Arc<str>)>
pub fn closure(&self, file: &Path) -> Vec<(PathBuf, Arc<str>)>
file and every module its relative imports reach, as read: file
first, then the rest in path order, each with its source. Empty when
file couldn’t be read.
Sourcepub fn hash(&self, file: &Path, known: &[String]) -> String
pub fn hash(&self, file: &Path, known: &[String]) -> String
A module’s version: a hash of its source, the sources of every module
its relative imports reach (each with its path), the widget names it
can render and devpage’s build — everything its compiled bytes are
made from. Snapshot::address is the address that carries it.
Sourcepub fn address(&self, file: &Path, known: &[String]) -> String
pub fn address(&self, file: &Path, known: &[String]) -> String
The address file is served at, carrying its version:
the one a page names it by and an import of it asks for.
Panics on a file outside the served folder, which has no address: a snapshot reads and imports only modules inside it, so that is a mistake in devpage, not in a document.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Snapshot
impl Freeze for Snapshotwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<PathBuf, Read> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(PathBuf, Read)>>: Freeze,
*const ArcInner<Caches> is !null: Freeze,
PhantomData<ArcInner<Caches>>: Freeze,
impl Move for Snapshot
impl RefUnwindSafe for Snapshotwhere
Atomic<usize>: RefUnwindSafe,
Mutex<HashMap<PathBuf, Read>>: RefUnwindSafe,
Mutex<HashMap<u64, Result<String, String>>>: RefUnwindSafe,
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshotwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<PathBuf, Read> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(PathBuf, Read)>>: UnsafeUnpin,
*const ArcInner<Caches> is !null: UnsafeUnpin,
PhantomData<ArcInner<Caches>>: UnsafeUnpin,
impl UnwindSafe for Snapshot
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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
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