pub trait Banner:
Send
+ Sync
+ 'static {
// Required method
fn render(cx: &Cx) -> impl Future<Output = Result<Option<impl View>>> + Send;
}Expand description
A strip above every page of a panel, under the bar that names whom a user acts as, installed
with Panel::banner: what the signed-in user must see wherever they
are, such as a failed payment or an expiring trial.
use tablo_core::{Banner, Panel, auth};
use topcoat::{
Result,
context::Cx,
view::{View, view},
};
struct PaymentFailed;
impl Banner for PaymentFailed {
async fn render(cx: &Cx) -> Result<Option<impl View>> {
// A real banner reads the signed-in user's billing state here.
let failed = auth::signed_in(cx) && false;
Ok(failed.then(|| view! { <div role="alert">"Your last payment failed."</div> }))
}
}
Panel::new("app").banner::<PaymentFailed>();Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".