Struct hdrhistogram::serialization::interval_log::IntervalLogIterator[][src]

pub struct IntervalLogIterator<'a> { /* fields omitted */ }

Parse interval logs.

This iterator exposes each item (excluding comments and other information-free lines). See LogEntry.

Because histogram deserialization is deferred, parsing logs is fast. See the interval_log benchmark if you wish to see how it does on your hardware. As a baseline, parsing a log of 1000 random histograms of 10,000 values each takes 2ms total on an E5-1650v3.

Deferring deserialization is handy because it allows you to cheaply navigate the log to find the records you care about (e.g. ones in a certain time range, or with a certain tag) without doing all the allocation, etc, of deserialization.

If you’re looking for a direct port of the Java impl’s HistogramLogReader, this isn’t one: it won’t deserialize for you, and it pushes the burden of figuring out what to do with StartTime, BaseTime, etc to you, and there aren’t built in functions to filter by timestamp. On the other hand, because it doesn’t do those things, it is much more flexible: you can easily build any sort of filtering you want, not just timestamp ranges, because you have cheap access to all the metadata before incurring the cost of deserialization. If you’re not using any timestamp headers, or at least using them in straightforward ways, it is easy to accumulate the timestamp state you need. Since all the parsing is taken care of already, writing your own HistogramLogReader equivalent that fits the way your logs are assembled is just a couple of lines. (And if you’re doing complex stuff, we probably wouldn’t have built something that fits your quirky logs anyway!)

This parses from a slice representing the complete file because it made implementation easier (and also supports mmap’d files for maximum parsing speed). If parsing from a Read is important for your use case, open an issue about it.

Implementations

impl<'a> IntervalLogIterator<'a>[src]

pub fn new(input: &'a [u8]) -> IntervalLogIterator<'a>

Notable traits for IntervalLogIterator<'a>

impl<'a> Iterator for IntervalLogIterator<'a> type Item = Result<LogEntry<'a>, LogIteratorError>;
[src]

Create a new iterator from the UTF-8 bytes of an interval log.

Trait Implementations

impl<'a> Iterator for IntervalLogIterator<'a>[src]

type Item = Result<LogEntry<'a>, LogIteratorError>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> RefUnwindSafe for IntervalLogIterator<'a>

impl<'a> Send for IntervalLogIterator<'a>

impl<'a> Sync for IntervalLogIterator<'a>

impl<'a> Unpin for IntervalLogIterator<'a>

impl<'a> UnwindSafe for IntervalLogIterator<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.