pub struct BrowserViewer { /* private fields */ }Expand description
WASM-facing portable viewer and bounded remote-range cache.
Implementations§
Source§impl BrowserViewer
impl BrowserViewer
Sourcepub fn new_default(
width: u32,
height: u32,
range_budget_json: &str,
) -> Result<BrowserViewer, JsValue>
pub fn new_default( width: u32, height: u32, range_budget_json: &str, ) -> Result<BrowserViewer, JsValue>
Creates a deterministic empty viewer for browser smoke tests and simple embeds.
Sourcepub fn new(
state_json: &str,
range_budget_json: &str,
) -> Result<BrowserViewer, JsValue>
pub fn new( state_json: &str, range_budget_json: &str, ) -> Result<BrowserViewer, JsValue>
Creates a browser viewer from strict state and range-budget JSON.
Sourcepub fn state_json(&self) -> Result<String, JsValue>
pub fn state_json(&self) -> Result<String, JsValue>
Returns strict portable viewer-state JSON.
Sourcepub fn apply_input_json(&mut self, input_json: &str) -> Result<(), JsValue>
pub fn apply_input_json(&mut self, input_json: &str) -> Result<(), JsValue>
Applies one strict BrowserInput JSON object.
Sourcepub fn plan_ranges_json(
&mut self,
ranges_json: &str,
cancelled: bool,
) -> Result<String, JsValue>
pub fn plan_ranges_json( &mut self, ranges_json: &str, cancelled: bool, ) -> Result<String, JsValue>
Plans sorted/deduplicated bounded cache misses from a JSON range array.
Sourcepub fn admit_range(
&mut self,
start: u64,
end_exclusive: u64,
bytes: &Uint8Array,
) -> Result<String, JsValue>
pub fn admit_range( &mut self, start: u64, end_exclusive: u64, bytes: &Uint8Array, ) -> Result<String, JsValue>
Explicitly copies a fetched JS byte array into the bounded WASM cache.
The returned JSON receipt reports the exact copied and evicted bytes.
Sourcepub fn cached_range(
&mut self,
start: u64,
end_exclusive: u64,
) -> Result<Option<Uint8Array>, JsValue>
pub fn cached_range( &mut self, start: u64, end_exclusive: u64, ) -> Result<Option<Uint8Array>, JsValue>
Explicitly copies an exact cached range back into a JS byte array.
Trait Implementations§
Source§impl From<BrowserViewer> for JsValue
impl From<BrowserViewer> for JsValue
Source§fn from(value: BrowserViewer) -> Self
fn from(value: BrowserViewer) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for BrowserViewer
impl FromWasmAbi for BrowserViewer
Source§impl IntoWasmAbi for BrowserViewer
impl IntoWasmAbi for BrowserViewer
Source§impl LongRefFromWasmAbi for BrowserViewer
impl LongRefFromWasmAbi for BrowserViewer
Source§type Abi = WasmPtr<WasmRefCell<BrowserViewer>>
type Abi = WasmPtr<WasmRefCell<BrowserViewer>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<BrowserViewer>
type Anchor = RcRef<BrowserViewer>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for BrowserViewer
impl OptionFromWasmAbi for BrowserViewer
Source§impl OptionIntoWasmAbi for BrowserViewer
impl OptionIntoWasmAbi for BrowserViewer
Source§impl RefFromWasmAbi for BrowserViewer
impl RefFromWasmAbi for BrowserViewer
Source§type Abi = WasmPtr<WasmRefCell<BrowserViewer>>
type Abi = WasmPtr<WasmRefCell<BrowserViewer>>
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = RcRef<BrowserViewer>
type Anchor = RcRef<BrowserViewer>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for BrowserViewer
impl RefMutFromWasmAbi for BrowserViewer
Source§type Abi = WasmPtr<WasmRefCell<BrowserViewer>>
type Abi = WasmPtr<WasmRefCell<BrowserViewer>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<BrowserViewer>
type Anchor = RcRefMut<BrowserViewer>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl TryFromJsValue for BrowserViewer
impl TryFromJsValue for BrowserViewer
Source§impl VectorFromWasmAbi for BrowserViewer
impl VectorFromWasmAbi for BrowserViewer
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[BrowserViewer]>
Source§impl VectorIntoWasmAbi for BrowserViewer
impl VectorIntoWasmAbi for BrowserViewer
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[BrowserViewer]>) -> Self::Abi
Source§impl WasmDescribeVector for BrowserViewer
impl WasmDescribeVector for BrowserViewer
impl SupportsConstructor for BrowserViewer
impl SupportsInstanceProperty for BrowserViewer
impl SupportsStaticProperty for BrowserViewer
Auto Trait Implementations§
impl Freeze for BrowserViewer
impl RefUnwindSafe for BrowserViewer
impl Send for BrowserViewer
impl Sync for BrowserViewer
impl Unpin for BrowserViewer
impl UnsafeUnpin for BrowserViewer
impl UnwindSafe for BrowserViewer
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.