Trait zng_view::extensions::ViewExtension
source · pub trait ViewExtension: Send + Any {
// Required method
fn name(&self) -> &ApiExtensionName;
// Provided methods
fn init(&mut self, args: ViewExtensionInitArgs) { ... }
fn command(
&mut self,
request: ApiExtensionPayload,
) -> Option<ApiExtensionPayload> { ... }
fn window(&mut self) -> Option<Box<dyn WindowExtension>> { ... }
fn renderer(&mut self) -> Option<Box<dyn RendererExtension>> { ... }
fn low_memory(&mut self) { ... }
fn suspended(&mut self) { ... }
fn resumed(&mut self) { ... }
}
Expand description
The extension API.
Required Methods§
sourcefn name(&self) -> &ApiExtensionName
fn name(&self) -> &ApiExtensionName
Unique name and version of this extension.
Provided Methods§
sourcefn init(&mut self, args: ViewExtensionInitArgs)
fn init(&mut self, args: ViewExtensionInitArgs)
Called once at the start of the view-process.
sourcefn command(
&mut self,
request: ApiExtensionPayload,
) -> Option<ApiExtensionPayload>
fn command( &mut self, request: ApiExtensionPayload, ) -> Option<ApiExtensionPayload>
Run the extension as an app level command.
sourcefn window(&mut self) -> Option<Box<dyn WindowExtension>>
fn window(&mut self) -> Option<Box<dyn WindowExtension>>
Create a WindowExtension
for a new window instance.
sourcefn renderer(&mut self) -> Option<Box<dyn RendererExtension>>
fn renderer(&mut self) -> Option<Box<dyn RendererExtension>>
Create a RendererExtension
for a new renderer instance.
sourcefn low_memory(&mut self)
fn low_memory(&mut self)
System warning low memory, release unused memory, caches.
sourcefn suspended(&mut self)
fn suspended(&mut self)
App is being suspended, all graphic resources must be dropped.
Android and iOS apps can be suspended without fully exiting, all graphic resources must be dropped on suspension, and any persistent state must be flushed because the app will process will exit if the user does not return to the app.
Note that window
and renderer
resources are managed by the app and will be dropped automatically, this
callback only needs to drop custom graphic resources.