Struct tether_utils::tether_topics::insights::Insights

source ·
pub struct Insights { /* private fields */ }

Implementations§

source§

impl Insights

source

pub fn new(options: &TopicOptions, tether_agent: &TetherAgent) -> Self

Examples found in repository?
examples/api.rs (line 62)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
fn demo_topics() {
    let tether_agent = TetherAgentOptionsBuilder::new("demoTopics")
        .build()
        .expect("failed to init/connect Tether Agent");

    let options = TopicOptions {
        topic: "#".into(),
        sampler_interval: 1000,
        graph_enable: false,
    };

    let mut insights = Insights::new(&options, &tether_agent);

    loop {
        while let Some((_plug_name, message)) = tether_agent.check_messages() {
            if insights.update(&message) {
                println!("TOPICS: Insights update: \n{}", insights);
            }
        }
    }
}
source

pub fn sample(&mut self) -> bool

source

pub fn sampler(&self) -> &Sampler

source

pub fn update(&mut self, message: &Message) -> bool

Examples found in repository?
examples/api.rs (line 66)
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
fn demo_topics() {
    let tether_agent = TetherAgentOptionsBuilder::new("demoTopics")
        .build()
        .expect("failed to init/connect Tether Agent");

    let options = TopicOptions {
        topic: "#".into(),
        sampler_interval: 1000,
        graph_enable: false,
    };

    let mut insights = Insights::new(&options, &tether_agent);

    loop {
        while let Some((_plug_name, message)) = tether_agent.check_messages() {
            if insights.update(&message) {
                println!("TOPICS: Insights update: \n{}", insights);
            }
        }
    }
}
source

pub fn topics(&self) -> &[String]

source

pub fn roles(&self) -> &[String]

source

pub fn ids(&self) -> &[String]

source

pub fn plugs(&self) -> &[String]

source

pub fn trees(&self) -> &[AgentTree]

source

pub fn message_count(&self) -> u128

source

pub fn message_log( &self ) -> &CircularBuffer<MONITOR_LOG_LENGTH, (String, String)>

source

pub fn since_log_start(&self) -> Option<Duration>

source

pub fn get_rate(&self) -> Option<f32>

Messages per second, since log_start was (re)set

Trait Implementations§

source§

impl Display for Insights

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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.