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§

source

fn name(&self) -> &ApiExtensionName

Unique name and version of this extension.

Provided Methods§

source

fn init(&mut self, args: ViewExtensionInitArgs)

Called once at the start of the view-process.

source

fn command( &mut self, request: ApiExtensionPayload, ) -> Option<ApiExtensionPayload>

Run the extension as an app level command.

source

fn window(&mut self) -> Option<Box<dyn WindowExtension>>

Create a WindowExtension for a new window instance.

source

fn renderer(&mut self) -> Option<Box<dyn RendererExtension>>

Create a RendererExtension for a new renderer instance.

source

fn low_memory(&mut self)

System warning low memory, release unused memory, caches.

source

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.

source

fn resumed(&mut self)

App resumed from a suspended state.

Expect window and renderer requests to recrate previous instances.

Note that this is not called on init, only after a suspension.

Implementors§