pub struct DynamicScriptManager {
pending_fetches: Vec<PendingFetch>,
}Fields§
§pending_fetches: Vec<PendingFetch>Implementations§
Source§impl DynamicScriptManager
impl DynamicScriptManager
pub fn new() -> Self
pub fn has_pending(&self) -> bool
pub fn clear(&mut self)
Sourcepub 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>)
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>)
スクリプト要素の追加を受け取り、即時実行アクションまたはフェッチ要求を返す(既定 is_async = true)。
Sourcepub 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>)
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>)
async 属性(true = 到着順、false = 挿入順)を考慮してスクリプト要素の追加を処理する。
Sourcepub fn poll_pending<F>(&mut self, cache_reader: F) -> Vec<DynamicScriptAction>
pub fn poll_pending<F>(&mut self, cache_reader: F) -> Vec<DynamicScriptAction>
保留中のフェッチ要求をポーリングし、到着済みのスクリプトのアクションを返す。
ordered(async = false)のスクリプトは先行する ordered スクリプトがすべて完了するまで待機し、
!ordered(async = true)のスクリプトは到着次第すぐに返す。
Sourcepub fn take_failed<F>(&mut self, failed: F) -> Vec<DynamicScriptAction>
pub fn take_failed<F>(&mut self, failed: F) -> Vec<DynamicScriptAction>
取得に失敗した保留中のスクリプトを外し、error を発火するアクションを返す。
これが無いと失敗した要素は永久に保留のまま残り、load/error のどちらも来ない。
Trait Implementations§
Source§impl Debug for DynamicScriptManager
impl Debug for DynamicScriptManager
Auto Trait Implementations§
impl Freeze for DynamicScriptManager
impl RefUnwindSafe for DynamicScriptManager
impl Send for DynamicScriptManager
impl Sync for DynamicScriptManager
impl Unpin for DynamicScriptManager
impl UnsafeUnpin for DynamicScriptManager
impl UnwindSafe for DynamicScriptManager
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
Mutably borrows from an owned value. Read more