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>,
        component_name: &'static str,
    ) -> 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 as guarantee that your memoization strategy is safe.

If your props are ’static, then Dioxus will require that they also be PartialEq for the derived memoize strategy.

By default, the memoization strategy is very conservative, but can be tuned to be more aggressive manually. However, this is only safe if the props are ’static - otherwise you might borrow references after-free.

We strongly suggest that any changes to memoization be done at the “PartialEq” level for ’static props. Additionally, we advise the use of smart pointers in cases where memoization is important.

§Example

For props that are ’static:

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

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>, component_name: &'static str, ) -> 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 LinkProps
where LinkProps: Clone,

§

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

§

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

§

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

§

impl<R> Properties for RouterProps<R>
where R: Routable, RouterProps<R>: Clone, <R as FromStr>::Err: Display,

§

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

§

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

§

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

Implementors§

§

impl Properties for AccordionBodyProps

§

type Builder = AccordionBodyPropsBuilder<((),)>

§

impl Properties for AccordionProps

§

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

§

impl Properties for AccordionSummaryProps

§

type Builder = AccordionSummaryPropsBuilder<((),)>

§

impl Properties for AnimatedRouterProps

§

type Builder = AnimatedRouterPropsBuilder<((),)>

§

impl Properties for ArrowIconProps

§

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

§

impl Properties for BaseButtonProps

§

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

§

impl Properties for BodyProps

§

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

§

impl Properties for BottomTabProps

§

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

§

impl Properties for ButtonProps

§

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

§

impl Properties for CanvasProps

§

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

§

impl Properties for CheckboxProps

§

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

§

impl Properties for CrossIconProps

§

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

§

impl Properties for CursorAreaProps

§

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

§

impl Properties for DragProviderProps

§

type Builder = DragProviderPropsBuilder<((),)>

§

impl Properties for GestureAreaProps

§

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

§

impl Properties for GraphProps

§

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

§

impl Properties for InputProps

§

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

§

impl Properties for freya::prelude::LinkProps

§

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

§

impl Properties for LoaderProps

§

type Builder = LoaderPropsBuilder<((),)>

§

impl Properties for MenuButtonProps

§

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

§

impl Properties for MenuContainerProps

§

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

§

impl Properties for MenuItemProps

§

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

§

impl Properties for MenuProps

§

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

§

impl Properties for NativeContainerProps

§

type Builder = NativeContainerPropsBuilder<((),)>

§

impl Properties for NativeRouterProps

§

type Builder = NativeRouterPropsBuilder<((),)>

§

impl Properties for NetworkImageProps

§

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

§

impl Properties for PopupBackgroundProps

§

type Builder = PopupBackgroundPropsBuilder<((),)>

§

impl Properties for PopupContentProps

§

type Builder = PopupContentPropsBuilder<((),)>

§

impl Properties for PopupProps

§

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

§

impl Properties for PopupTitleProps

§

type Builder = PopupTitlePropsBuilder<((),)>

§

impl Properties for ProgressBarProps

§

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

§

impl Properties for RadioProps

§

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

§

impl Properties for ScrollBarProps

§

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

§

impl Properties for ScrollThumbProps

§

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

§

impl Properties for ScrollViewProps

§

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

§

impl Properties for SidebarItemProps

§

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

§

impl Properties for SidebarProps

§

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

§

impl Properties for SliderProps

§

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

§

impl Properties for SnackBarBoxProps

§

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

§

impl Properties for SnackBarProps

§

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

§

impl Properties for SubMenuProps

§

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

§

impl Properties for SwitchProps

§

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

§

impl Properties for TabProps
where TabProps: Clone,

§

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

§

impl Properties for TableBodyProps

§

type Builder = TableBodyPropsBuilder<((),)>

§

impl Properties for TableCellProps

§

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

§

impl Properties for TableHeadProps

§

type Builder = TableHeadPropsBuilder<((),)>

§

impl Properties for TableProps

§

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

§

impl Properties for TableRowProps

§

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

§

impl Properties for TabsbarProps

§

type Builder = TabsbarPropsBuilder<((),)>

§

impl Properties for ThemeProviderProps

§

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

§

impl Properties for TickIconProps

§

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

§

impl Properties for TileProps

§

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

§

impl Properties for TooltipContainerProps

§

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

§

impl Properties for TooltipProps

§

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

§

impl Properties for WindowDragAreaProps

§

type Builder = WindowDragAreaPropsBuilder<((),)>

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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

§

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