pub struct Designs(/* private fields */);Expand description
The designs of one folder, from a Store: every design asked for,
kept resolved in memory.
Implementations§
Source§impl Designs
impl Designs
Sourcepub fn new(served: &ServedFolder) -> Designs
pub fn new(served: &ServedFolder) -> Designs
The designs of the served folder, in a store of their own.
Sourcepub fn resolve(&self, path: &str) -> Result<Scene, Vec<Problem>>
pub fn resolve(&self, path: &str) -> Result<Scene, Vec<Problem>>
The design at path resolved — its scene, copied — or its problems.
Sourcepub fn next(&self, path: &str, sent: Option<u64>) -> Next
pub fn next(&self, path: &str, sent: Option<u64>) -> Next
What a watch stream that last sent the design at path at version
sent — or nothing, None — sends next: the design’s problems, its
whole scene, the patches since that version as one, or nothing new.
The patches were made once, when the design was resolved again, and
every stream sends the same.
Sourcepub fn problems(&self, path: &str) -> Vec<Problem>
pub fn problems(&self, path: &str) -> Vec<Problem>
The design at path’s problems — resolving it, or drawing its scene
in each theme it shows in: what devpage check and a page’s problems
bar report. None when it resolves and draws.
Sourcepub fn made_of(&self, path: &str) -> Vec<PathBuf>
pub fn made_of(&self, path: &str) -> Vec<PathBuf>
Everything the design at path is made of, as the store read it:
the design itself, its imports, images, themes and fonts — every
file a resolve of it has read since it was last resolved whole,
whether or not it resolves — and every folder it listed, a font
folder, with the fonts it then read from it. A file or folder it
asked for that isn’t there is among them, named as it would be. A
change to any of them — a file in a listed folder added or removed
among them — is a change to the design.
Sourcepub fn on_change(&self, listener: impl Fn(&str) + Send + Sync + 'static)
pub fn on_change(&self, listener: impl Fn(&str) + Send + Sync + 'static)
Tells listener the address of each design whose scene or problems
change from now on, as the engine names it — what
Designs::resolve then answers anew. It is called on the thread
that reported the change, so it should only pass the address on.
Sourcepub fn changed(&self, file: &Path)
pub fn changed(&self, file: &Path)
A file in the served folder changed, was created or was deleted: forget it and its folder’s listing, resolve again every design that asked for either, and announce the designs whose scene or problems changed.
Sourcepub fn etag(&self, path: &str, theme: Theme) -> Option<String>
pub fn etag(&self, path: &str, theme: Theme) -> Option<String>
The validator of the design at path’s PNG in theme, known before
painting: the version of its scene — one more for every change to it
— of this store, the theme, and devpage’s build, which paints it.
None when it doesn’t resolve. It may resolve the design, so it
blocks.
Sourcepub fn png_to(
&self,
path: &str,
theme: Theme,
out: impl Write,
) -> Result<(), String>
pub fn png_to( &self, path: &str, theme: Theme, out: impl Write, ) -> Result<(), String>
The design at path as a PNG in theme, written to out band by band
— each band at most 16 MB of pixels: one row of tiles at 1×, from the
store’s cache, only the missing and stale ones painted, or for a drawing
too wide for that, shorter strips painted and not cached — or its
problems one per line, before anything is written. Painting blocks; a
writer that fails — a client gone — stops it.
No lock of the store’s is held while out is written to, so a client
that stops reading holds up nothing but its own PNG. A save that
changes the design while its PNG is written ends the PNG there, with
an error, rather than finish it from another scene.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Designs
impl Freeze for Designs
impl RefUnwindSafe for Designs
impl Send for Designs
impl Sync for Designs
impl Unpin for Designs
impl UnsafeUnpin for Designs
impl UnwindSafe for Designs
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> 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
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