Skip to main content

Content

Struct Content 

Source
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: ContentType

The kind of resource this content represents.

§url: Mutex<Option<String>>

Object URL of the generated blob, set once the content is loaded.

§id: Id

Unique identifier of this content entry.

§ident: &'static str

Human-readable identifier, used as the injected element’s id.

§content: &'static str

The 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: AtomicBool

Whether this content has already been injected into the DOM.

Implementations§

Source§

impl Content

Source

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.

Source

pub fn is_loaded(&self) -> bool

Return true if this content has already been injected into the DOM.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more