Skip to main content

PlatformBridge

Trait PlatformBridge 

Source
pub trait PlatformBridge: Send + Sync {
    // Required methods
    fn platform_id(&self) -> PlatformId;
    fn create_view(&self, view_type: ViewType, node_id: NodeId) -> NativeHandle;
    fn update_view(
        &self,
        handle: NativeHandle,
        props: &PropsDiff,
    ) -> Result<(), PlatformError>;
    fn remove_view(&self, handle: NativeHandle);
    fn insert_child(
        &self,
        parent: NativeHandle,
        child: NativeHandle,
        index: usize,
    );
    fn remove_child(&self, parent: NativeHandle, child: NativeHandle);
    fn measure_text(
        &self,
        text: &str,
        style: &TextStyle,
        max_width: f32,
    ) -> TextMetrics;
    fn screen_size(&self) -> ScreenSize;
    fn scale_factor(&self) -> f32;
    fn supports(&self, capability: PlatformCapability) -> bool;
}
Expand description

Every platform bridge MUST implement this trait.

Required Methods§

Source

fn platform_id(&self) -> PlatformId

Source

fn create_view(&self, view_type: ViewType, node_id: NodeId) -> NativeHandle

Source

fn update_view( &self, handle: NativeHandle, props: &PropsDiff, ) -> Result<(), PlatformError>

Source

fn remove_view(&self, handle: NativeHandle)

Source

fn insert_child(&self, parent: NativeHandle, child: NativeHandle, index: usize)

Source

fn remove_child(&self, parent: NativeHandle, child: NativeHandle)

Source

fn measure_text( &self, text: &str, style: &TextStyle, max_width: f32, ) -> TextMetrics

Source

fn screen_size(&self) -> ScreenSize

Source

fn scale_factor(&self) -> f32

Source

fn supports(&self, capability: PlatformCapability) -> bool

Implementors§