Output

Struct Output 

Source
pub struct Output<W>
where W: Write,
{ /* private fields */ }
Expand description

File handler responsible for storing data to a file.

Implementations§

Source§

impl<W> Output<W>
where W: Write,

Source

pub fn new(output: W) -> Self

Creates new Output handler

§Arguments
  • output - structur which implements io::Write
Source

pub fn set_write_path(self, write_path: bool) -> Self

Set whether to show path

§Arguments
  • use_path - should path be shown in the output
§Example
use std::io::stdout;
use streamson_lib::handler;
let output = handler::Output::new(stdout())
    .set_write_path(true);
Source

pub fn set_separator<S>(self, separator: S) -> Self
where S: ToString,

Set which separator will be used in the output

Note that every separator will be extended to every found item.

§Arguments
  • separator - how found record will be separated
§Example
use std::io::stdout;
use streamson_lib::handler;
let output = handler::Output::new(stdout())
    .set_separator("######\n");

Trait Implementations§

Source§

impl FromStr for Output<File>

Source§

type Err = Handler

The associated error which can be returned from parsing.
Source§

fn from_str(input: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<W> Handler for Output<W>
where W: Write + Send + 'static,

Source§

fn start( &mut self, path: &Path, _matcher_idx: usize, _token: Token, ) -> Result<Option<Vec<u8>>, Handler>

Is called when a path is matched Read more
Source§

fn feed( &mut self, data: &[u8], _matcher_idx: usize, ) -> Result<Option<Vec<u8>>, Handler>

Is called when handler receives some data Read more
Source§

fn end( &mut self, _path: &Path, _matcher_idx: usize, _token: Token, ) -> Result<Option<Vec<u8>>, Handler>

Is called when the path is no longer matched Read more
Source§

fn as_any(&self) -> &dyn Any

Function to allow downcasting
Source§

fn is_converter(&self) -> bool

Should be handler used to convert data

Auto Trait Implementations§

§

impl<W> Freeze for Output<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for Output<W>
where W: RefUnwindSafe,

§

impl<W> Send for Output<W>
where W: Send,

§

impl<W> Sync for Output<W>
where W: Sync,

§

impl<W> Unpin for Output<W>
where W: Unpin,

§

impl<W> UnwindSafe for Output<W>
where W: UnwindSafe,

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.