pub trait Viewer {
// Required method
fn actor(&self) -> &str;
// Provided methods
fn claims(&self) -> &BTreeMap<Arc<str>, Arc<str>> { ... }
fn path(&self) -> &str { ... }
}Expand description
Who a view is rendered for, or a command proposed by.
A trait rather than a type because the two sources of one are genuinely different and both are
legitimate. A connection supplies a beck_rt::identity::Actor, which only that module’s
Identity::verify can make and which carries the claims the provider verified — the impl for it
is there rather than here, because the credential is the host’s to check. A name supplies
itself: beck test’s when session("ana") sends …, the differential harness, a benchmark, a
client of the playground’s tab server — none of them is a connection, so none of them has a
credential to check, and each of them has no claims because there was nobody to make any.
One code path either way, which is the point: a &str and an Actor reach the same Session
constructor, so a claim cannot appear in one render path and not another.
Required Methods§
Provided Methods§
Sourcefn path(&self) -> &str
fn path(&self) -> &str
Where this viewer is — the route, as the browser last stated it.
Defaulted rather than required, and the default is the application’s root: a viewer that is
not a browser has no route, and beck test, the differential harness and every benchmark
are exactly that. The one implementation that overrides it is the subscription’s, because a
socket is the only thing that can be told the route changed.
Implementations on Foreign Types§
Source§impl<T: Viewer + ?Sized> Viewer for &T
So a caller holding a &&str — which is what iterating a [&str] gives — needs no ceremony.
impl<T: Viewer + ?Sized> Viewer for &T
So a caller holding a &&str — which is what iterating a [&str] gives — needs no ceremony.