[−][src]Struct metrix::cockpit::Cockpit
A cockpit groups panels.
Use a cockpit to group panels that are somehow related. Since the Cockpit is generic over its label you can use an enum as a label for grouping panels easily.
Methods
impl<L> Cockpit<L> where
L: Clone + Eq + Send + 'static,
[src]
L: Clone + Eq + Send + 'static,
pub fn new<T: Into<String>>(name: T) -> Cockpit<L>
[src]
Creates a new instance.
Even though the name is optional it is suggested to use
a name for a cockpit since in most cases a Cockpit
is
a meaningful grouping for panels and instruments.
pub fn without_name() -> Cockpit<L>
[src]
Creates a new Cockpit
without a name.
This will have the effect that there will be no grouping in the snapshot around the contained components.
pub fn name(&self) -> Option<&str>
[src]
use get_name. this method will change its signature
Returns the name of this cockpit.
If there is a name set, this will group the inner components in the snapshot.
pub fn get_name(&self) -> Option<&str>
[src]
Returns the name of this cockpit.
If there is a name set, this will group the inner components in the snapshot.
pub fn set_name<T: Into<String>>(&mut self, name: T)
[src]
Sets a name for this Cockpit
. This will also enable grouping.
pub fn set_title<T: Into<String>>(&mut self, title: T)
[src]
Sets the title which will be displayed if a descriptive snapshot is requested.
pub fn set_description<T: Into<String>>(&mut self, description: T)
[src]
Sets the description which will be displayed if a descriptive snapshot is requested.
pub fn set_inactivity_limit(&mut self, limit: Duration)
[src]
Sets the maximum amount of time this cockpit may be inactive until no more snapshots are taken
pub fn add_panel(&mut self, panel: Panel<L>)
[src]
Add a Panel
to this cockpit.
A Panel
will receive only those Observation
s where
labels match.
There can not be multiple Panel
s for the same label.
If one already exists, the new one will not be added.
pub fn remove_panel<T: AsRef<str>>(&mut self, name: T)
[src]
Removes a Panel
from this cockpit.
Removes the Panel
with the given name from this cockpit a
a Panel
with the given name exists
pub fn panel(self, panel: Panel<L>) -> Self
[src]
Add a Panel
to this cockpit.
A Panel
will receive only those Observation
s where
labels match.
There can be multiple Panel
s for the same label.
pub fn get_panels(&self) -> Vec<&Panel<L>>
[src]
Returns the Panel
s
pub fn get_panels_mut(&mut self) -> Vec<&mut Panel<L>>
[src]
Returns the Panel
s mutable
pub fn add_handler<T>(&mut self, handler: T) where
T: HandlesObservations<Label = L>,
[src]
T: HandlesObservations<Label = L>,
Add a handler. This can be custom logic for metrics.
A handler will be passed all Observation
s unlike
a Panel
which will only receive Observation
s where
the label matches.
pub fn handlers(&self) -> Vec<&dyn HandlesObservations<Label = L>>
[src]
use get_handlers. this method will change its signature
Returns all the handlers.
pub fn get_handlers(&self) -> Vec<&dyn HandlesObservations<Label = L>>
[src]
Returns all the handlers.
pub fn handler<H: HandlesObservations<Label = L>>(self, handler: H) -> Self
[src]
pub fn add_snapshooter<T: PutsSnapshot>(&mut self, snapshooter: T)
[src]
Adds a snapshooter.
A snapshooter will only be invoked when a Snapshot
is requested.
It will never receive an Observation
.
pub fn snapshooter<T: PutsSnapshot>(self, snapshooter: T) -> Self
[src]
Adds a snapshooter.
A snapshooter will only be invoked when a Snapshot
is requested.
It will never receive an Observation
.
pub fn snapshooters(&self) -> Vec<&dyn PutsSnapshot>
[src]
use get_snapshooters. this method will change its signature
Returns all snapshooters.
pub fn get_snapshooters(&self) -> Vec<&dyn PutsSnapshot>
[src]
Returns all snapshooters.
Trait Implementations
impl<L> Default for Cockpit<L> where
L: Clone + Eq + Send + 'static,
[src]
L: Clone + Eq + Send + 'static,
impl<L> Descriptive for Cockpit<L>
[src]
impl<L> HandlesObservations for Cockpit<L> where
L: Clone + Eq + Send + 'static,
[src]
L: Clone + Eq + Send + 'static,
type Label = L
fn handle_observation(
&mut self,
observation: &Observation<Self::Label>
) -> usize
[src]
&mut self,
observation: &Observation<Self::Label>
) -> usize
impl<L> PutsSnapshot for Cockpit<L> where
L: Clone + Eq + Send + 'static,
[src]
L: Clone + Eq + Send + 'static,
fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)
[src]
Auto Trait Implementations
impl<L> !RefUnwindSafe for Cockpit<L>
impl<L> Send for Cockpit<L> where
L: Send,
L: Send,
impl<L> !Sync for Cockpit<L>
impl<L> Unpin for Cockpit<L> where
L: Unpin,
L: Unpin,
impl<L> !UnwindSafe for Cockpit<L>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,