Struct linemux::MuxedLines[][src]

pub struct MuxedLines { /* fields omitted */ }

Manages file watches, and can be polled to receive new lines.

Streaming multiplexed lines

MuxedLines implements futures::Stream which internally:

  1. Receives a new event from MuxedEvents.
  2. Performs housekeeping for the event, such as moving pending file readers to active, handling file rotation, etc.
  3. Reads an active file reader if the event suggests that the file was modified.
  4. Returns a Poll::Ready for each line that could be read, via Line

Implementations

impl MuxedLines[src]

pub fn new() -> Result<Self>[src]

pub async fn add_file(&mut self, path: impl Into<PathBuf>) -> Result<PathBuf>[src]

Adds a given file to the lines watch, allowing for files which do not yet exist.

Returns the canonicalized version of the path originally supplied, to match against the one contained in each Line received. Otherwise returns io::Error for a given registration failure.

pub async fn next_line(&mut self) -> Result<Option<Line>>[src]

Returns the next line in the stream.

Waits for the next line from the set of watched files, otherwise returns Ok(None) if no files were ever added, or Err for a given error.

Trait Implementations

impl Debug for MuxedLines[src]

impl Stream for MuxedLines[src]

type Item = Result<Line>

Values yielded by the stream.

impl<'__pin> Unpin for MuxedLines where
    __Origin<'__pin>: Unpin
[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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

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

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

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

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

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.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized
[src]