pub struct Breadcrumb<S> { /* private fields */ }Expand description
A trail of links to the pages above the current one, ending at it.
It is a <nav> named by its label, holding an ordered list. The current
page ends the trail as text with aria-current="page", and
Breadcrumb::current is the only way to finish one, so a trail always
names the page it is on and nothing follows it. The separators are
hidden from assistive technology.
use hypersig::{Page, Route, Signals};
use hypersig_ui::Breadcrumb;
use serde::{Deserialize, Serialize};
#[derive(Signals, Serialize, Deserialize)]
struct Issue {}
hypersig::routes! {
fn pages(Router<()>);
const HOME: Route = "/" => page;
const ISSUES: Route = "/issues" => page;
}
let trail = Breadcrumb::<Issue>::new("Breadcrumb")
.link("Home", HOME.link())
.link("Issues", ISSUES.link())
.current("Login is slow");
let html = trail.render();
assert!(html.contains(r#"<nav aria-label="Breadcrumb""#));
assert!(html.contains(r#"aria-current="page""#));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Breadcrumb<S>
impl<S> RefUnwindSafe for Breadcrumb<S>
impl<S> Send for Breadcrumb<S>
impl<S> Sync for Breadcrumb<S>
impl<S> Unpin for Breadcrumb<S>
impl<S> UnsafeUnpin for Breadcrumb<S>
impl<S> UnwindSafe for Breadcrumb<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more