Skip to main content

Module route

Module route 

Source
Expand description

Routing: which views show a notice.

egui-pop gives the mechanism, the application the policy. A policy (NoticeRouting) is given each notice raised and answers a Route: the Surfaces that show it (inline at its place, a toast, the status bar’s badge, the history, the Decisions surface). default_route is egui-pop’s own policy, the table below; an application installs its own in its place.

NoticeSurfaces
an ask (any origin)Decisions, history
a condition (any origin)inline at its place when a site shows it, history; badge when a warning or an error
a user’s error or warninginline at its place when a site shows it, else a toast; history
a user’s information or successtoast, history
a background, node or system error or warningbadge, history (never a toast)
a background, node or system information or successhistory
use egui_pop_model::notice::Notice;
use egui_pop_model::notice::route::{RouteCx, Surface, default_route};

let cx = RouteCx::new(["settings/storage/nodes"]);
let failed = Notice::error("cloudy was not added").place("settings/storage/nodes");
assert_eq!(
    default_route(&failed, &cx).surfaces,
    [Surface::Inline("settings/storage/nodes".into()), Surface::History]
);
Experimental: may change in any release (docs/stability.md).

Structs§

DefaultRouting
egui-pop’s own policy: default_route.
Route
The surfaces a policy picked for one notice, in order.
RouteCx
What a policy knows besides the notice: the places a notice site shows now.

Enums§

Surface
A view that shows a notice.

Traits§

NoticeRouting
An application’s routing policy. A closure Fn(&Notice, &RouteCx) -> Route is one.

Functions§

default_route
egui-pop’s default routing table (the module’s): background work never pops up, a user’s own failure shows where it happened.