pub struct ExtensionRegistry { /* private fields */ }Expand description
The providers this module was built with, and the sources a page opened.
Failures are thrown as plain string messages, not Error objects.
Implementations§
Source§impl ExtensionRegistry
impl ExtensionRegistry
Sourcepub fn supports(&self, provider: &str) -> bool
pub fn supports(&self, provider: &str) -> bool
Whether this module opens a project’s provider source (JSON).
Sourcepub fn probe(&self, bytes: &[u8]) -> Result<Option<String>, JsValue>
pub fn probe(&self, bytes: &[u8]) -> Result<Option<String>, JsValue>
The first claiming provider’s result as JSON { provider, report }, or undefined.
§Errors
If a claiming provider cannot read the bytes.
Sourcepub fn register_resource(&mut self, locator: String, bytes: Vec<u8>)
pub fn register_resource(&mut self, locator: String, bytes: Vec<u8>)
Registers bytes under a locator. Sources read them only during open or render, so a page
may register them just for that call (see Self::needs).
Sourcepub fn release_resource(&mut self, locator: &str)
pub fn release_resource(&mut self, locator: &str)
Forgets the bytes registered under a locator.
Sourcepub fn resource_bytes(&self) -> usize
pub fn resource_bytes(&self) -> usize
Total bytes registered under locators.
Sourcepub fn register_font(&mut self, bytes: Vec<u8>)
pub fn register_font(&mut self, bytes: Vec<u8>)
Registers a font for SVG text. Sources read fonts when they open.
Sourcepub fn clear_fonts(&mut self)
pub fn clear_fonts(&mut self)
Forgets every registered font; open sources keep theirs.
Sourcepub fn open_needs(&self, provider: &str) -> Result<String, JsValue>
pub fn open_needs(&self, provider: &str) -> Result<String, JsValue>
Locators opening a provider source (JSON) reads, as a JSON array.
§Errors
When the provider source is not valid JSON.
Sourcepub fn needs(&self, handle: u32, time_ticks: i64) -> Result<String, JsValue>
pub fn needs(&self, handle: u32, time_ticks: i64) -> Result<String, JsValue>
Locators rendering at a source tick reads that the source does not hold, as a JSON array.
§Errors
When the handle is not open.
Sourcepub fn open(
&mut self,
provider: &str,
bytes: Option<Vec<u8>>,
) -> Result<u32, JsValue>
pub fn open( &mut self, provider: &str, bytes: Option<Vec<u8>>, ) -> Result<u32, JsValue>
Opens a provider source (JSON) with its bytes (none for an image sequence or LaTeX) and returns a handle.
§Errors
If the source cannot be opened.
Sourcepub fn render(
&mut self,
handle: u32,
time_ticks: i64,
fit_width: u32,
fit_height: u32,
) -> Result<RenderedFrame, JsValue>
pub fn render( &mut self, handle: u32, time_ticks: i64, fit_width: u32, fit_height: u32, ) -> Result<RenderedFrame, JsValue>
The frame at a source tick. Vector sources rasterize to fit fit_width by fit_height
(0 by 0 for their own size).
§Errors
When the handle is not open or the frame cannot be produced.
Sourcepub fn resident_bytes(&self, handle: u32) -> Result<usize, JsValue>
pub fn resident_bytes(&self, handle: u32) -> Result<usize, JsValue>
Bytes an open source holds between renders (cached frames, images, and file bytes).
§Errors
When the handle is not open.
Sourcepub fn reader(&mut self, handle: u32) -> Result<Option<u32>, JsValue>
pub fn reader(&mut self, handle: u32) -> Result<Option<u32>, JsValue>
A handle to another independently positioned reader that shares the source’s decoded
data. It stays valid after the original is closed. undefined when any time is equally
cheap to draw, so the page should share the source.
§Errors
When the handle is not open.
The part of Self::resident_bytes shared with Self::reader readers, counted once.
§Errors
When the handle is not open.
Trait Implementations§
Source§impl Default for ExtensionRegistry
impl Default for ExtensionRegistry
Source§impl From<ExtensionRegistry> for JsValue
impl From<ExtensionRegistry> for JsValue
Source§fn from(value: ExtensionRegistry) -> Self
fn from(value: ExtensionRegistry) -> Self
Source§impl FromWasmAbi for ExtensionRegistry
impl FromWasmAbi for ExtensionRegistry
Source§impl IntoWasmAbi for ExtensionRegistry
impl IntoWasmAbi for ExtensionRegistry
Source§impl LongRefFromWasmAbi for ExtensionRegistry
impl LongRefFromWasmAbi for ExtensionRegistry
Source§type Abi = WasmPtr<WasmRefCell<ExtensionRegistry>>
type Abi = WasmPtr<WasmRefCell<ExtensionRegistry>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<ExtensionRegistry>
type Anchor = RcRef<ExtensionRegistry>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl RefFromWasmAbi for ExtensionRegistry
impl RefFromWasmAbi for ExtensionRegistry
Source§type Abi = WasmPtr<WasmRefCell<ExtensionRegistry>>
type Abi = WasmPtr<WasmRefCell<ExtensionRegistry>>
Self are recovered from.Source§type Anchor = RcRef<ExtensionRegistry>
type Anchor = RcRef<ExtensionRegistry>
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 ExtensionRegistry
impl RefMutFromWasmAbi for ExtensionRegistry
Source§type Abi = WasmPtr<WasmRefCell<ExtensionRegistry>>
type Abi = WasmPtr<WasmRefCell<ExtensionRegistry>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<ExtensionRegistry>
type Anchor = RcRefMut<ExtensionRegistry>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for ExtensionRegistry
impl SupportsInstanceProperty for ExtensionRegistry
impl SupportsStaticProperty for ExtensionRegistry
Source§impl TryFromJsValue for ExtensionRegistry
impl TryFromJsValue for ExtensionRegistry
Source§impl VectorFromWasmAbi for ExtensionRegistry
impl VectorFromWasmAbi for ExtensionRegistry
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[ExtensionRegistry]>
Source§impl VectorIntoWasmAbi for ExtensionRegistry
impl VectorIntoWasmAbi for ExtensionRegistry
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[ExtensionRegistry]>) -> Self::Abi
Source§impl WasmDescribeVector for ExtensionRegistry
impl WasmDescribeVector for ExtensionRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for ExtensionRegistry
impl !Sync for ExtensionRegistry
impl !UnwindSafe for ExtensionRegistry
impl Freeze for ExtensionRegistry
impl Send for ExtensionRegistry
impl Unpin for ExtensionRegistry
impl UnsafeUnpin for ExtensionRegistry
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().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
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.