pub struct Widgets {
pub modules: BTreeMap<String, String>,
pub problems: Vec<String>,
/* private fields */
}Expand description
The widgets a document’s pages can use: name → the address its module is served at.
Fields§
§modules: BTreeMap<String, String>§problems: Vec<String>Widget files that can’t be widgets: a lowercase name, or a system widget’s name.
Implementations§
Source§impl Widgets
impl Widgets
Sourcepub fn of(document: &Document, cache: &Modules) -> Self
pub fn of(document: &Document, cache: &Modules) -> Self
The system widgets plus the document’s own, from its widgets folder,
each at its content address, read and compiled
through cache.
Sourcepub fn compile(&self, file: &Path) -> Result<String>
pub fn compile(&self, file: &Path) -> Result<String>
A project widget or helper file of this set, compiled now as its
address serves it.
Sourcepub fn head(&self, content: &str, chrome: &[&str]) -> String
pub fn head(&self, content: &str, chrome: &[&str]) -> String
What the <head> of a page whose rendered content is content, in a
frame that mounts the widgets chrome, needs: the import map naming
React, the widgets the page script loads, and the page’s
load set — each module as a modulepreload at the
very address its import asks for, and the design engine’s wasm as a
low-priority fetch — so the browser asks for all of it at once, as
soon as it reads the head.
Sourcepub fn load_set(
&self,
content: &str,
chrome: &[&str],
) -> (Vec<String>, Vec<String>)
pub fn load_set( &self, content: &str, chrome: &[&str], ) -> (Vec<String>, Vec<String>)
Everything a page whose rendered content is content, in a frame that
mounts the widgets chrome — a site’s sidebar, SIDEBAR — loads
from devpage beyond its stylesheet and page script: the modules —
React if it has a widget; each widget it names, then the frame’s; the
widgets each of those renders by name (its __devpageUses), and so
on; every helper a project widget’s imports reach; the design script
and engine with an
embedded design — and what is fetched, not imported: the engine’s
wasm. Each is the address address makes, so it is the one the
import asks for.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Widgets
impl RefUnwindSafe for Widgets
impl Send for Widgets
impl Sync for Widgets
impl Unpin for Widgets
impl UnsafeUnpin for Widgets
impl UnwindSafe for Widgets
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