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>Every widget by name — system, extension and project alike — with the address its module is served at.
problems: Vec<String>What can’t be shown: a widget file with a lowercase name or a system widget’s name, and a place that names no widget.
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; and the document’s places, each naming widgets among
them.
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 and the page module, the widgets the page
script loads, the document’s places and its extensions’ addresses
when it has any, and the page’s load set, its
places’ widgets included — 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 module a 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 Forget for Widgets
impl Freeze for Widgetswhere
*const u8 is !null: Freeze,
PhantomData<Binding>: Freeze,
*const LeafNode<String, String> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, String)>>: Freeze,
*const ArcInner<Caches> is !null: Freeze,
PhantomData<ArcInner<Caches>>: Freeze,
PhantomData<u8>: Freeze,
*const LeafNode<String, PathBuf> is !null: Freeze,
PhantomData<Box<(String, PathBuf)>>: Freeze,
PhantomData<String>: Freeze,
impl Move for Widgets
impl RefUnwindSafe for Widgetswhere
Atomic<usize>: RefUnwindSafe,
Mutex<State>: RefUnwindSafe,
Mutex<HashMap<PathBuf, Read>>: RefUnwindSafe,
Mutex<HashMap<u64, Result<String, String>>>: RefUnwindSafe,
impl Send for Widgets
impl Sync for Widgets
impl Unpin for Widgets
impl UnsafeUnpin for Widgetswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Binding>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
*const ArcInner<Caches> is !null: UnsafeUnpin,
PhantomData<ArcInner<Caches>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, PathBuf> is !null: UnsafeUnpin,
PhantomData<Box<(String, PathBuf)>>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for Widgetswhere
RawVecInner: UnwindSafe,
Arc<Mutex<State>>: UnwindSafe,
BTreeMap<String, String>: UnwindSafe,
Arc<Caches>: UnwindSafe,
BTreeMap<String, PathBuf>: UnwindSafe,
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