ViewHandle

Trait ViewHandle 

Source
pub trait ViewHandle: Animatable {
    // Required methods
    fn layout_guide(&self) -> LayoutGuide<f32>;
    fn size<F>(&self, callback: F)
       where F: FnOnce(Size<f32>) + Send + 'static;
    fn size_with_buffer<F>(&self, buffer: &mut Self::CommandBuffer, callback: F)
       where F: FnOnce(Size<f32>) + Send + 'static;
}
Expand description

This trait is implemented by platform-specific View handles.

Required Methods§

Source

fn layout_guide(&self) -> LayoutGuide<f32>

This function should return the layout guides of this view. TODO: on what thread does this occur?

Source

fn size<F>(&self, callback: F)
where F: FnOnce(Size<f32>) + Send + 'static,

This function should call the given callback with the size of this view.

Source

fn size_with_buffer<F>(&self, buffer: &mut Self::CommandBuffer, callback: F)
where F: FnOnce(Size<f32>) + Send + 'static,

This function should call the given callback with the size of this view. Explicitly passing a command buffer ensures that the dimensions are measured in the same UI event loop iteration as the current render itself.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§