Flag

Struct Flag 

Source
pub struct Flag { /* private fields */ }
Expand description

A Flag which can have the states true or false

The Flag reacts on observations with values. A value of 0 sets the Flag to false, ‘1’ will set the Flag to true. For all other values the behaviour is undefined.

Implementations§

Source§

impl Flag

Source

pub fn new<T: Into<String>>(name: T) -> Self

Source

pub fn new_with_state<T: Into<String>>(name: T, initial_state: bool) -> Self

Source

pub fn get_name(&self) -> &str

Source

pub fn set_name<T: Into<String>>(&mut self, name: T)

Source

pub fn name<T: Into<String>>(self, name: T) -> Self

Source

pub fn set_title<T: Into<String>>(&mut self, title: T)

Source

pub fn title<T: Into<String>>(self, title: T) -> Self

Source

pub fn set_description<T: Into<String>>(&mut self, description: T)

Source

pub fn description<T: Into<String>>(self, description: T) -> Self

Source

pub fn state(self, initial_state: bool) -> Self

Source

pub fn set_show_inverted(&mut self, name_alternation: NameAlternation)

Show the inverted value. Name will be adjusted with name_alternation.

Source

pub fn show_inverted(self, name_alternation: NameAlternation) -> Self

Show the inverted value. Name will be adjusted with name_alternation.

Source

pub fn set_show_inverted_prefixed<T: Into<String>>(&mut self, prefix: T)

Show the inverted value. Name will be prefixed with prefix.

Source

pub fn show_inverted_prefixed<T: Into<String>>(self, prefix: T) -> Self

Show the inverted value. Name will be prefixed with prefix.

Source

pub fn set_show_inverted_postfixed<T: Into<String>>(&mut self, postfix: T)

Show the inverted value. Name will be postfixed with postfix.

Source

pub fn show_inverted_postfixed<T: Into<String>>(self, postfix: T) -> Self

Show the inverted value. Name will be postfixed with postfix.

Source

pub fn set_show_inverted_renamed<T: Into<String>>(&mut self, new_name: T)

Show the inverted value. Name will be renamed with new_name.

Source

pub fn show_inverted_renamed<T: Into<String>>(self, new_name: T) -> Self

Show the inverted value. Name will be renamed with new_name.

Source

pub fn accept<L: Eq + Send + 'static, F: Into<LabelFilter<L>>>( self, accept: F, ) -> InstrumentAdapter<L, Self>

Source

pub fn for_label<L: Eq + Send + 'static>( self, label: L, ) -> InstrumentAdapter<L, Self>

Creates an InstrumentAdapter that makes this instrument react on observations on the given label.

Source

pub fn for_labels<L: Eq + Send + 'static>( self, labels: Vec<L>, ) -> InstrumentAdapter<L, Self>

Creates an InstrumentAdapter that makes this instrument react on observations with the given labels.

If labels is empty the instrument will not react to any observations

Source

pub fn for_all_labels<L: Eq + Send + 'static>( self, ) -> InstrumentAdapter<L, Self>

Creates an InstrumentAdapter that makes this instrument react on all observations.

Source

pub fn for_labels_by_predicate<L, P>( self, label_predicate: P, ) -> InstrumentAdapter<L, Self>
where L: Eq + Send + 'static, P: Fn(&L) -> bool + Send + 'static,

Creates an InstrumentAdapter that makes this instrument react on observations with labels specified by the predicate.

Source

pub fn adapter<L: Eq + Send + 'static>(self) -> InstrumentAdapter<L, Self>

Creates an InstrumentAdapter that makes this instrument to no observations.

Source

pub fn get_state(&self) -> Option<bool>

Returns the current state

Trait Implementations§

Source§

impl Descriptive for Flag

Source§

fn title(&self) -> Option<&str>

Source§

fn description(&self) -> Option<&str>

Source§

impl PutsSnapshot for Flag

Source§

fn put_snapshot(&self, into: &mut Snapshot, descriptive: bool)

Puts the current snapshot values into the given Snapshot thereby following the guidelines of PutsSnapshot.
Source§

impl Updates for Flag

Source§

fn update(&mut self, with: &Update) -> usize

Update the internal state according to the given Update. Read more
Source§

impl Instrument for Flag

Auto Trait Implementations§

§

impl Freeze for Flag

§

impl RefUnwindSafe for Flag

§

impl Send for Flag

§

impl Sync for Flag

§

impl Unpin for Flag

§

impl UnwindSafe for Flag

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V