Skip to main content

ViewKind

Enum ViewKind 

Source
#[non_exhaustive]
pub enum ViewKind {
Show 13 variants Box, Row, Column, Stack, ZStack, OverlayHost, ScrollV { on_scroll: Option<ScrollCallback>, set_viewport_height: Option<Rc<dyn Fn(f32)>>, set_content_height: Option<Rc<dyn Fn(f32)>>, get_scroll_offset: Option<Rc<dyn Fn() -> f32>>, set_scroll_offset: Option<Rc<dyn Fn(f32)>>, show_scrollbar: bool, tick_scroll: Option<Rc<dyn Fn()>>, }, ScrollXY { on_scroll: Option<ScrollCallback>, set_viewport_width: Option<Rc<dyn Fn(f32)>>, set_viewport_height: Option<Rc<dyn Fn(f32)>>, set_content_width: Option<Rc<dyn Fn(f32)>>, set_content_height: Option<Rc<dyn Fn(f32)>>, get_scroll_offset_xy: Option<Rc<dyn Fn() -> (f32, f32)>>, set_scroll_offset_xy: Option<Rc<dyn Fn(f32, f32)>>, show_scrollbar: bool, tick_scroll: Option<Rc<dyn Fn()>>, }, Text {
Show 14 fields text: String, color: Color, font_size: f32, soft_wrap: bool, max_lines: Option<usize>, overflow: TextOverflow, font_family: Option<&'static str>, annotations: Option<Arc<[TextSpan]>>, text_align: TextAlign, font_weight: FontWeight, font_style: FontStyle, text_decoration: TextDecoration, letter_spacing: f32, line_height: f32,
}, Image { handle: ImageHandle, tint: Color, fit: ImageFit, }, SubcomposeLayout { content: Arc<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>>, }, Expander { expanded: bool, on_toggle: Option<Callback>, }, TreeRow { depth: usize, has_children: bool, is_expanded: bool, is_selected: bool, on_toggle: Option<Callback>, on_select: Option<Callback>, },
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Box

§

Row

§

Column

§

Stack

§

ZStack

§

OverlayHost

§

ScrollV

Fields

§set_viewport_height: Option<Rc<dyn Fn(f32)>>
§set_content_height: Option<Rc<dyn Fn(f32)>>
§get_scroll_offset: Option<Rc<dyn Fn() -> f32>>
§set_scroll_offset: Option<Rc<dyn Fn(f32)>>
§show_scrollbar: bool
§tick_scroll: Option<Rc<dyn Fn()>>
§

ScrollXY

Fields

§set_viewport_width: Option<Rc<dyn Fn(f32)>>
§set_viewport_height: Option<Rc<dyn Fn(f32)>>
§set_content_width: Option<Rc<dyn Fn(f32)>>
§set_content_height: Option<Rc<dyn Fn(f32)>>
§get_scroll_offset_xy: Option<Rc<dyn Fn() -> (f32, f32)>>
§set_scroll_offset_xy: Option<Rc<dyn Fn(f32, f32)>>
§show_scrollbar: bool
§tick_scroll: Option<Rc<dyn Fn()>>
§

Text

Fields

§text: String
§color: Color
§font_size: f32
§soft_wrap: bool
§max_lines: Option<usize>
§overflow: TextOverflow
§font_family: Option<&'static str>
§annotations: Option<Arc<[TextSpan]>>
§text_align: TextAlign
§font_weight: FontWeight
§font_style: FontStyle
§text_decoration: TextDecoration
§letter_spacing: f32
§line_height: f32
§

Image

Fields

§tint: Color
§

SubcomposeLayout

A layout whose children are produced by calling content with the current SubcomposeScope. The closure is invoked during reconciliation and returns a list of (slot_id, view) pairs. Each slot id is a stable identity used to reconcile the returned view across frames. This is the building block for BoxWithConstraints and other constraints-driven layouts.

Note: any Modifier::key set on a returned view is overwritten by its slot id so the slot’s identity is stable across frames.

Fields

§content: Arc<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>>
§

Expander

A collapsible section with a clickable header. First child is the header content; remaining children shown only when expanded.

Fields

§expanded: bool
§on_toggle: Option<Callback>
§

TreeRow

A single row in a tree view with indentation and expand/select support. First child is rendered as the row label/content.

Fields

§depth: usize
§has_children: bool
§is_expanded: bool
§is_selected: bool
§on_toggle: Option<Callback>
§on_select: Option<Callback>

Trait Implementations§

Source§

impl Clone for ViewKind

Source§

fn clone(&self) -> ViewKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ViewKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.