Trait freya::prelude::Properties

pub trait Properties:
    Sized
    + Clone
    + 'static {
    type Builder;

    // Required methods
    fn builder() -> Self::Builder;
    fn memoize(&mut self, other: &Self) -> bool;

    // Provided method
    fn into_vcomponent<M>(
        self,
        render_fn: impl ComponentFunction<Self, M>,
    ) -> VComponent
       where M: 'static { ... }
}
Expand description

Every “Props” used for a component must implement the Properties trait. This trait gives some hints to Dioxus on how to memoize the props and some additional optimizations that can be made. We strongly encourage using the derive macro to implement the Properties trait automatically.

Dioxus requires your props to be ’static, Clone, and PartialEq. We use the PartialEq trait to determine if the props have changed when we diff the component.

§Example

#[derive(Props, PartialEq, Clone)]
struct MyComponentProps {
    data: String
}

fn MyComponent(props: MyComponentProps) -> Element {
    rsx! {
        div { "Hello {props.data}" }
    }
}

Or even better, derive your entire props struct with the [#[crate::component]] macro:

#[component]
fn MyComponent(data: String) -> Element {
    rsx! {
        div { "Hello {data}" }
    }
}

Required Associated Types§

type Builder

The type of the builder for this component. Used to create “in-progress” versions of the props.

Required Methods§

fn builder() -> Self::Builder

Create a builder for this component.

fn memoize(&mut self, other: &Self) -> bool

Make the old props equal to the new props. Return if the props were equal and should be memoized.

Provided Methods§

fn into_vcomponent<M>( self, render_fn: impl ComponentFunction<Self, M>, ) -> VComponent
where M: 'static,

Create a component from the props.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl Properties for ()

§

type Builder = EmptyBuilder

§

fn builder() -> <() as Properties>::Builder

§

fn memoize(&mut self, _other: &()) -> bool

§

impl Properties for HistoryButtonProps
where HistoryButtonProps: Clone,

§

type Builder = HistoryButtonPropsBuilder<((),)>

§

fn builder() -> <HistoryButtonProps as Properties>::Builder

§

fn memoize(&mut self, new: &HistoryButtonProps) -> bool

§

impl Properties for HistoryProviderProps
where HistoryProviderProps: Clone,

§

type Builder = HistoryProviderPropsBuilder<((), ())>

§

fn builder() -> <HistoryProviderProps as Properties>::Builder

§

fn memoize(&mut self, new: &HistoryProviderProps) -> bool

§

impl Properties for LinkProps
where LinkProps: Clone,

§

type Builder = LinkPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), ())>

§

fn builder() -> <LinkProps as Properties>::Builder

§

fn memoize(&mut self, new: &LinkProps) -> bool

§

impl Properties for LinkProps
where LinkProps: Clone,

§

type Builder = LinkPropsBuilder<((), (), (), (), (), (), (), (), ())>

§

fn builder() -> <LinkProps as Properties>::Builder

§

fn memoize(&mut self, new: &LinkProps) -> bool

§

impl Properties for MetaProps
where MetaProps: Clone,

§

type Builder = MetaPropsBuilder<((), (), (), (), ())>

§

fn builder() -> <MetaProps as Properties>::Builder

§

fn memoize(&mut self, new: &MetaProps) -> bool

§

impl Properties for ScriptProps
where ScriptProps: Clone,

§

type Builder = ScriptPropsBuilder<((), (), (), (), (), (), (), (), (), ())>

§

fn builder() -> <ScriptProps as Properties>::Builder

§

fn memoize(&mut self, new: &ScriptProps) -> bool

§

impl Properties for StyleProps
where StyleProps: Clone,

§

type Builder = StylePropsBuilder<((), (), (), (), ())>

§

fn builder() -> <StyleProps as Properties>::Builder

§

fn memoize(&mut self, new: &StyleProps) -> bool

§

impl Properties for TitleProps
where TitleProps: Clone,

§

type Builder = TitlePropsBuilder<((),)>

§

fn builder() -> <TitleProps as Properties>::Builder

§

fn memoize(&mut self, new: &TitleProps) -> bool

§

impl<R> Properties for RouterProps<R>
where R: Clone + 'static, RouterProps<R>: Clone,

§

type Builder = RouterPropsBuilder<((),), R>

§

fn builder() -> <RouterProps<R> as Properties>::Builder

§

fn memoize(&mut self, new: &RouterProps<R>) -> bool

Implementors§

source§

impl Properties for AccordionBodyProps

source§

type Builder = AccordionBodyPropsBuilder<((),)>

source§

impl Properties for AccordionProps

source§

type Builder = AccordionPropsBuilder<((), (), ())>

source§

impl Properties for AccordionSummaryProps

source§

type Builder = AccordionSummaryPropsBuilder<((),)>

source§

impl Properties for AnimatedRouterProps

source§

type Builder = AnimatedRouterPropsBuilder<((),)>

source§

impl Properties for ArrowIconProps

source§

type Builder = ArrowIconPropsBuilder<((), (), ())>

source§

impl Properties for BaseButtonProps

source§

type Builder = BaseButtonPropsBuilder<((), (), (), ())>

source§

impl Properties for BodyProps

source§

type Builder = BodyPropsBuilder<((), ())>

source§

impl Properties for BottomTabProps

source§

type Builder = BottomTabPropsBuilder<((), ())>

source§

impl Properties for ButtonProps

source§

type Builder = ButtonPropsBuilder<((), (), (), ())>

source§

impl Properties for CanvasProps

source§

type Builder = CanvasPropsBuilder<((), ())>

source§

impl Properties for CheckboxProps

source§

type Builder = CheckboxPropsBuilder<((), ())>

source§

impl Properties for CrossIconProps

source§

type Builder = CrossIconPropsBuilder<((), ())>

source§

impl Properties for CursorAreaProps

source§

type Builder = CursorAreaPropsBuilder<((), ())>

source§

impl Properties for DragProviderProps

source§

type Builder = DragProviderPropsBuilder<((),)>

source§

impl Properties for GestureAreaProps

source§

type Builder = GestureAreaPropsBuilder<((), ())>

source§

impl Properties for GraphProps

source§

type Builder = GraphPropsBuilder<((), (), ())>

source§

impl Properties for InputProps

source§

type Builder = InputPropsBuilder<((), (), (), (), (), ())>

source§

impl Properties for freya::prelude::LinkProps

source§

type Builder = LinkPropsBuilder<((), (), (), (), ())>

source§

impl Properties for LoaderProps

source§

type Builder = LoaderPropsBuilder<((),)>

source§

impl Properties for MenuButtonProps

source§

type Builder = MenuButtonPropsBuilder<((), ())>

source§

impl Properties for MenuContainerProps

source§

type Builder = MenuContainerPropsBuilder<((), ())>

source§

impl Properties for MenuItemProps

source§

type Builder = MenuItemPropsBuilder<((), (), (), ())>

source§

impl Properties for MenuProps

source§

type Builder = MenuPropsBuilder<((), ())>

source§

impl Properties for NativeContainerProps

source§

type Builder = NativeContainerPropsBuilder<((),)>

source§

impl Properties for NativeRouterProps

source§

type Builder = NativeRouterPropsBuilder<((),)>

source§

impl Properties for NetworkImageProps

source§

type Builder = NetworkImagePropsBuilder<((), (), (), (), ())>

source§

impl Properties for PopupBackgroundProps

source§

type Builder = PopupBackgroundPropsBuilder<((),)>

source§

impl Properties for PopupContentProps

source§

type Builder = PopupContentPropsBuilder<((),)>

source§

impl Properties for PopupProps

source§

type Builder = PopupPropsBuilder<((), (), (), (), ())>

source§

impl Properties for PopupTitleProps

source§

type Builder = PopupTitlePropsBuilder<((),)>

source§

impl Properties for ProgressBarProps

source§

type Builder = ProgressBarPropsBuilder<((), (), ())>

source§

impl Properties for RadioProps

source§

type Builder = RadioPropsBuilder<((), ())>

source§

impl Properties for ScrollBarProps

source§

type Builder = ScrollBarPropsBuilder<((), (), (), (), (), (), ())>

source§

impl Properties for ScrollThumbProps

source§

type Builder = ScrollThumbPropsBuilder<((), (), (), (), ())>

source§

impl Properties for ScrollViewProps

source§

type Builder = ScrollViewPropsBuilder<((), (), (), (), (), (), (), (), (), (), ())>

source§

impl Properties for SidebarItemProps

source§

type Builder = SidebarItemPropsBuilder<((), (), ())>

source§

impl Properties for SidebarProps

source§

type Builder = SidebarPropsBuilder<((), (), ())>

source§

impl Properties for SliderProps

source§

type Builder = SliderPropsBuilder<((), (), (), (), ())>

source§

impl Properties for SnackBarBoxProps

source§

type Builder = SnackBarBoxPropsBuilder<((), ())>

source§

impl Properties for SnackBarProps

source§

type Builder = SnackBarPropsBuilder<((), (), ())>

source§

impl Properties for SubMenuProps

source§

type Builder = SubMenuPropsBuilder<((), ())>

§

impl Properties for SuspenseBoundaryProps

§

type Builder = SuspenseBoundaryPropsBuilder<((), ())>

source§

impl Properties for SwitchProps

source§

type Builder = SwitchPropsBuilder<((), (), ())>

source§

impl Properties for TabProps
where TabProps: Clone,

source§

type Builder = TabPropsBuilder<((), (), ())>

source§

impl Properties for TableBodyProps

source§

type Builder = TableBodyPropsBuilder<((),)>

source§

impl Properties for TableCellProps

source§

type Builder = TableCellPropsBuilder<((), (), (), (), ())>

source§

impl Properties for TableHeadProps

source§

type Builder = TableHeadPropsBuilder<((),)>

source§

impl Properties for TableProps

source§

type Builder = TablePropsBuilder<((), (), ())>

source§

impl Properties for TableRowProps

source§

type Builder = TableRowPropsBuilder<((), (), ())>

source§

impl Properties for TabsbarProps

source§

type Builder = TabsbarPropsBuilder<((),)>

source§

impl Properties for ThemeProviderProps

source§

type Builder = ThemeProviderPropsBuilder<((), ())>

source§

impl Properties for TickIconProps

source§

type Builder = TickIconPropsBuilder<((), ())>

source§

impl Properties for TileProps

source§

type Builder = TilePropsBuilder<((), (), (), ())>

source§

impl Properties for TooltipContainerProps

source§

type Builder = TooltipContainerPropsBuilder<((), (), ())>

source§

impl Properties for TooltipProps

source§

type Builder = TooltipPropsBuilder<((), ())>

source§

impl Properties for WindowDragAreaProps

source§

type Builder = WindowDragAreaPropsBuilder<((),)>

source§

impl<Builder, BuilderArgs> Properties for VirtualScrollViewProps<Builder, BuilderArgs>
where Builder: 'static + Clone + Fn(usize, &Option<BuilderArgs>) -> Result<VNode, RenderError>, BuilderArgs: Clone + 'static + PartialEq, VirtualScrollViewProps<Builder, BuilderArgs>: Clone,

source§

type Builder = VirtualScrollViewPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), ()), Builder, BuilderArgs>

source§

impl<T> Properties for ActivableRouteProps<T>
where T: Clone + PartialEq + Routable + 'static, ActivableRouteProps<T>: Clone,

source§

type Builder = ActivableRoutePropsBuilder<((), (), (), ()), T>

source§

impl<T> Properties for DragZoneProps<T>
where T: Clone + 'static + PartialEq, DragZoneProps<T>: Clone,

source§

type Builder = DragZonePropsBuilder<((), (), (), ()), T>

source§

impl<T> Properties for DropZoneProps<T>
where T: 'static + PartialEq + Clone, DropZoneProps<T>: Clone,

source§

type Builder = DropZonePropsBuilder<((), ()), T>

source§

impl<T> Properties for DropdownItemProps<T>
where T: 'static + Clone + PartialEq, DropdownItemProps<T>: Clone,

source§

type Builder = DropdownItemPropsBuilder<((), (), (), ()), T>

source§

impl<T> Properties for DropdownProps<T>
where T: 'static + Clone + PartialEq, DropdownProps<T>: Clone,

source§

type Builder = DropdownPropsBuilder<((), (), ()), T>