Skip to main content

DynamicScriptManager

Struct DynamicScriptManager 

Source
pub struct DynamicScriptManager {
    pending_fetches: Vec<PendingFetch>,
}

Fields§

§pending_fetches: Vec<PendingFetch>

Implementations§

Source§

impl DynamicScriptManager

Source

pub fn new() -> Self

Source

pub fn has_pending(&self) -> bool

Source

pub fn clear(&mut self)

Source

pub fn process_script<F>( &mut self, idx: usize, src: Option<&str>, ty: &str, text: &str, page_url: &str, cache_reader: F, ) -> (Vec<DynamicScriptAction>, Option<DynamicScriptFetchRequest>)
where F: Fn(&str, &str) -> Option<Vec<u8>>,

スクリプト要素の追加を受け取り、即時実行アクションまたはフェッチ要求を返す(既定 is_async = true)。

Source

pub fn process_script_with_async<F>( &mut self, idx: usize, src: Option<&str>, ty: &str, text: &str, page_url: &str, is_async: bool, cache_reader: F, ) -> (Vec<DynamicScriptAction>, Option<DynamicScriptFetchRequest>)
where F: Fn(&str, &str) -> Option<Vec<u8>>,

async 属性(true = 到着順、false = 挿入順)を考慮してスクリプト要素の追加を処理する。

Source

pub fn poll_pending<F>(&mut self, cache_reader: F) -> Vec<DynamicScriptAction>
where F: Fn(&str, &str) -> Option<Vec<u8>>,

保留中のフェッチ要求をポーリングし、到着済みのスクリプトのアクションを返す。 ordered(async = false)のスクリプトは先行する ordered スクリプトがすべて完了するまで待機し、 !ordered(async = true)のスクリプトは到着次第すぐに返す。

Source

pub fn take_failed<F>(&mut self, failed: F) -> Vec<DynamicScriptAction>
where F: Fn(&str, &str) -> bool,

取得に失敗した保留中のスクリプトを外し、error を発火するアクションを返す。 これが無いと失敗した要素は永久に保留のまま残り、load/error のどちらも来ない。

Trait Implementations§

Source§

impl Debug for DynamicScriptManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DynamicScriptManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.