Trait zng_view::extensions::BlobExtension
source · pub trait BlobExtension: Send + Any {
// Required methods
fn create_blob_rasterizer(&mut self) -> Box<dyn AsyncBlobRasterizer>;
fn create_similar(&self) -> Box<dyn BlobExtension>;
fn add(&mut self, args: &BlobAddArgs);
fn update(&mut self, args: &BlobUpdateArgs);
fn delete(&mut self, key: BlobImageKey);
fn enable_multithreading(&mut self, enable: bool);
// Provided methods
fn prepare_resources(&mut self, args: &mut BlobPrepareArgs<'_>) { ... }
fn delete_font(&mut self, key: FontKey) { ... }
fn delete_font_instance(&mut self, key: FontInstanceKey) { ... }
fn clear_namespace(&mut self, namespace: IdNamespace) { ... }
}
Expand description
Represents a Webrender blob handler that can coexist with other blob handlers on the same renderer.
This API is very similar to Webrender’s BlobImageHandler
, the only difference is that implementers
are expected to detect and ignore requests targeting other blob extensions as multiple extensions may
implement blob renderers.
See RendererConfigArgs::blobs
for more details.
Required Methods§
sourcefn create_blob_rasterizer(&mut self) -> Box<dyn AsyncBlobRasterizer>
fn create_blob_rasterizer(&mut self) -> Box<dyn AsyncBlobRasterizer>
Creates a snapshot of the current state of blob images in the handler.
sourcefn create_similar(&self) -> Box<dyn BlobExtension>
fn create_similar(&self) -> Box<dyn BlobExtension>
New blob extension instance of the same type.
sourcefn add(&mut self, args: &BlobAddArgs)
fn add(&mut self, args: &BlobAddArgs)
Register a blob image if the request addresses this extension.
sourcefn update(&mut self, args: &BlobUpdateArgs)
fn update(&mut self, args: &BlobUpdateArgs)
Update a blob image if the request addresses this extension.
sourcefn delete(&mut self, key: BlobImageKey)
fn delete(&mut self, key: BlobImageKey)
Remove a blob image if the key was generated by this extension.
sourcefn enable_multithreading(&mut self, enable: bool)
fn enable_multithreading(&mut self, enable: bool)
Sets if multi-threading is allowed.
The default is true
, this method is only called on init if multithreading is disabled.
Provided Methods§
sourcefn prepare_resources(&mut self, args: &mut BlobPrepareArgs<'_>)
fn prepare_resources(&mut self, args: &mut BlobPrepareArgs<'_>)
Prepare resources that are not bundled in with the encoded request commands.
The extension must ignore requests not addressing it.
sourcefn delete_font(&mut self, key: FontKey)
fn delete_font(&mut self, key: FontKey)
Cleanup any prepared resource for the font.
sourcefn delete_font_instance(&mut self, key: FontInstanceKey)
fn delete_font_instance(&mut self, key: FontInstanceKey)
Cleanup any prepared resource for the font instance.
sourcefn clear_namespace(&mut self, namespace: IdNamespace)
fn clear_namespace(&mut self, namespace: IdNamespace)
Cleanup any state related with the namespace.