Trait avalanche::renderer::Renderer[][src]

pub trait Renderer {
    fn create_component(
        &mut self,
        native_type: &NativeType,
        component: &View
    ) -> NativeHandle;
fn append_child(
        &mut self,
        parent_type: &NativeType,
        parent_handle: &mut NativeHandle,
        child_type: &NativeType,
        child_handle: &NativeHandle
    );
fn insert_child(
        &mut self,
        parent_type: &NativeType,
        parent_handle: &mut NativeHandle,
        index: usize,
        child_type: &NativeType,
        child_handle: &NativeHandle
    );
fn replace_child(
        &mut self,
        parent_type: &NativeType,
        parent_handle: &mut NativeHandle,
        index: usize,
        child_type: &NativeType,
        child_handle: &NativeHandle
    );
fn swap_children(
        &mut self,
        parent_type: &NativeType,
        parent_handle: &mut NativeHandle,
        a: usize,
        b: usize
    );
fn move_child(
        &mut self,
        parent_type: &NativeType,
        parent_handle: &mut NativeHandle,
        old: usize,
        new: usize
    );
fn remove_child(
        &mut self,
        parent_type: &NativeType,
        parent_handle: &mut NativeHandle,
        index: usize
    );
fn update_component(
        &mut self,
        native_type: &NativeType,
        native_handle: &mut NativeHandle,
        component: &View
    ); fn log(&self, _string: &str) { ... } }
Expand description

The interface through which avalanche updates the native UI as described by changes to components. This allows avalanche to be platform-agnostic.

Required methods

Given a component and its native type, generate its native representation and return an opaque NativeHandle to it.

Appends the component with handle child_handle into the component with handle parent_handle’s children.

Inserts the component with handle child_handle into the component with handle parent_handle’s children at the given index, shifting all children after it to the right.

Panics

Panics if index > len, where len is the number of children the parent has.

Replaces the component at position index with the native component with handle child_handle. The implementation should implement replacing a component with itself as a noop.

Panics

Panics if index > len - 1, where len is the number of children the parent has.

Swaps the children at indices a and b.

Panics

Panics if a or b are less than len, where len is the number of children the parent has.

Moves the child at position old to the position new.

Panics

Panics if old < len or new < len where len is the number of children

Removes the component with the given index from the component with handle parent_handle.

Updates the component’s corresponding native handle so that the representation and result match.

Provided methods

Logs the given string to a platform-appropriate destination. This method is a placeholder, and may either be elaborated or replaced with the log crate

Implementors