pub struct Content {
pub content_type: ContentType,
pub url: Mutex<Option<String>>,
pub id: Id,
pub ident: &'static str,
pub content: &'static str,
pub references: Option<&'static [(Reference, Option<&'static str>, Id)]>,
pub is_loaded: AtomicBool,
}Expand description
A single loadable DOM resource (JavaScript module, script or CSS stylesheet) together with its identity, embedded source and the other content entries it references.
Fields§
§content_type: ContentTypeThe kind of resource this content represents.
url: Mutex<Option<String>>Object URL of the generated blob, set once the content is loaded.
id: IdUnique identifier of this content entry.
ident: &'static strHuman-readable identifier, used as the injected element’s id.
content: &'static strThe embedded source text of the resource.
references: Option<&'static [(Reference, Option<&'static str>, Id)]>Other content entries this resource imports from or exports, each as a reference kind, optional detail string and target content id.
is_loaded: AtomicBoolWhether this content has already been injected into the DOM.
Implementations§
Source§impl Content
impl Content
Sourcepub fn url(&self) -> Option<String>
pub fn url(&self) -> Option<String>
Return the object URL of this content’s blob once it has been created,
or None if it has not yet been loaded.
Sourcepub fn is_loaded(&self) -> bool
pub fn is_loaded(&self) -> bool
Return true if this content has already been injected into the DOM.
Sourcepub async fn load(self: Arc<Self>, ctx: &Arc<Context>) -> Result<ContentStatus>
pub async fn load(self: Arc<Self>, ctx: &Arc<Context>) -> Result<ContentStatus>
Load this content (and its dependencies) into the DOM through the
given Context, returning the resulting ContentStatus.