pub enum AlertPanelMessage {
UpdateMetric {
id: String,
value: f64,
},
AddMetric(AlertMetric),
RemoveMetric(String),
SetMetrics(Vec<AlertMetric>),
SelectNext,
SelectPrev,
SelectUp,
SelectDown,
SetColumns(usize),
Select,
}Expand description
Messages that can be sent to an AlertPanel.
§Example
use envision::component::{
AlertPanel, AlertPanelState, AlertPanelMessage, AlertMetric, AlertThreshold,
Component,
};
let mut state = AlertPanelState::new().with_metrics(vec![
AlertMetric::new("cpu", "CPU", AlertThreshold::new(70.0, 90.0)).with_value(50.0),
]);
let output = state.update(AlertPanelMessage::UpdateMetric {
id: "cpu".into(),
value: 80.0,
});
assert!(output.is_some());Variants§
UpdateMetric
Update a metric’s value by id.
AddMetric(AlertMetric)
Add a new metric.
RemoveMetric(String)
Remove a metric by id.
SetMetrics(Vec<AlertMetric>)
Replace all metrics.
SelectNext
Select the next metric.
SelectPrev
Select the previous metric.
SelectUp
Navigate up in the grid.
SelectDown
Navigate down in the grid.
SetColumns(usize)
Set the number of grid columns.
Select
Confirm selection of the current metric.
Trait Implementations§
Source§impl Clone for AlertPanelMessage
impl Clone for AlertPanelMessage
Source§fn clone(&self) -> AlertPanelMessage
fn clone(&self) -> AlertPanelMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AlertPanelMessage
impl Debug for AlertPanelMessage
Source§impl<'de> Deserialize<'de> for AlertPanelMessage
impl<'de> Deserialize<'de> for AlertPanelMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AlertPanelMessage
impl PartialEq for AlertPanelMessage
Source§impl Serialize for AlertPanelMessage
impl Serialize for AlertPanelMessage
impl StructuralPartialEq for AlertPanelMessage
Auto Trait Implementations§
impl Freeze for AlertPanelMessage
impl RefUnwindSafe for AlertPanelMessage
impl Send for AlertPanelMessage
impl Sync for AlertPanelMessage
impl Unpin for AlertPanelMessage
impl UnsafeUnpin for AlertPanelMessage
impl UnwindSafe for AlertPanelMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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