pub struct AlertsPanel { /* private fields */ }Expand description
An alert panel connected to the host’s Alerts service.
Call poll each frame even while hidden, so triggers produce notifications.
Creation returns an intent to open the shared alert dialog. Only host pushes change the list;
successful saves and removals never invent local state. Accounts, evaluation and delivery
outside the application remain the host’s responsibility.
Implementations§
Source§impl AlertsPanel
impl AlertsPanel
Sourcepub fn new(config: AlertsPanelConfig) -> Self
pub fn new(config: AlertsPanelConfig) -> Self
Create an unconnected panel. Attach a service with set_service.
Sourcepub fn set_symbol(&mut self, symbol: &str)
pub fn set_symbol(&mut self, symbol: &str)
Start the Quick alert form on symbol, such as the chart’s. Call it every frame: the form
follows a change of symbol and keeps what the user typed otherwise.
Sourcepub fn set_sources(&mut self, sources: Vec<(AlertSource, String)>)
pub fn set_sources(&mut self, sources: Vec<(AlertSource, String)>)
Offer these study outputs and drawings, as stable identifiers and display names, to the inline alert form.
Sourcepub fn set_inputs(&mut self, inputs: AlertInputs, timeframe: Option<Timeframe>)
pub fn set_inputs(&mut self, inputs: AlertInputs, timeframe: Option<Timeframe>)
Creation inputs for the inline form, captured from its source view by the host.
Sourcepub fn set_notification_seconds(&mut self, seconds: f32)
pub fn set_notification_seconds(&mut self, seconds: f32)
Keep each trigger notification on screen for this many seconds, five by default.
Sourcepub fn set_sound(&mut self, sound: Option<String>)
pub fn set_sound(&mut self, sound: Option<String>)
The sound to play when an alert fires, as the user chose it in the alert settings: its
name, empty for the host’s first sound, or None when the user turned the sound off.
Sourcepub fn take_sound(&mut self) -> Option<String>
pub fn take_sound(&mut self) -> Option<String>
Sourcepub fn set_service(&mut self, service: Arc<dyn Alerts>)
pub fn set_service(&mut self, service: Arc<dyn Alerts>)
Attach a host service, clearing the previous account’s alerts and log.
Sourcepub fn log(&self) -> &VecDeque<AlertTrigger>
pub fn log(&self) -> &VecDeque<AlertTrigger>
The most recent 10,000 host triggers in arrival order.
Sourcepub fn save(&mut self, alert: Alert)
pub fn save(&mut self, alert: Alert)
Save an alert from the shared dialog. The list changes only after a host push.
Sourcepub fn poll(&mut self, ctx: &Context, toasts: &mut Toasts)
pub fn poll(&mut self, ctx: &Context, toasts: &mut Toasts)
Drain service pushes and replies, recover a lagged stream, and append trigger notifications.
Render toasts once per frame with the host’s other notifications.
Sourcepub fn log_csv(&self) -> String
pub fn log_csv(&self) -> String
Export the retained trigger log. Text fields are quoted and embedded quotes doubled.
Sourcepub fn show(&mut self, ui: &mut Ui) -> AlertPanelAction
pub fn show(&mut self, ui: &mut Ui) -> AlertPanelAction
Render the host’s alerts or trigger log after poll, returning creation or export intents.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AlertsPanel
impl !UnwindSafe for AlertsPanel
impl Freeze for AlertsPanel
impl Send for AlertsPanel
impl Sync for AlertsPanel
impl Unpin for AlertsPanel
impl UnsafeUnpin for AlertsPanel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more