Struct streamson_lib::handler::buffer::Buffer [−][src]
pub struct Buffer { /* fields omitted */ }
Buffer handler responsible for storing slitted JSONs into memory
Implementations
impl Buffer
[src]
impl Buffer
[src]pub fn set_use_path(self, use_path: bool) -> Self
[src]
pub fn set_use_path(self, use_path: bool) -> Self
[src]pub fn pop(&mut self) -> Option<(Option<String>, Vec<u8>)>
[src]
pub fn pop(&mut self) -> Option<(Option<String>, Vec<u8>)>
[src]Pops the oldest value in the buffer
Returns
None
- queue is emptySome((path, data))
- stored data remove from the queue and returned
Example
use streamson_lib::handler; let mut buffer = handler::buffer::Buffer::new().set_use_path(true); while let Some((path, data)) = buffer.pop() { // Do something with the data println!("{} (len {})", path.unwrap(), data.len()); }
pub fn set_max_buffer_size(self, max_size: Option<usize>) -> Self
[src]
pub fn set_max_buffer_size(self, max_size: Option<usize>) -> Self
[src]Trait Implementations
impl Handler for Buffer
[src]
impl Handler for Buffer
[src]fn start(
&mut self,
_path: &Path,
_matcher_idx: usize,
token: Token
) -> Result<Option<Vec<u8>>, Handler>
[src]
fn start(
&mut self,
_path: &Path,
_matcher_idx: usize,
token: Token
) -> Result<Option<Vec<u8>>, Handler>
[src]Is called when a path is matched Read more
fn feed(
&mut self,
data: &[u8],
_matcher_idx: usize
) -> Result<Option<Vec<u8>>, Handler>
[src]
fn feed(
&mut self,
data: &[u8],
_matcher_idx: usize
) -> Result<Option<Vec<u8>>, Handler>
[src]Is called when handler receives some data Read more
fn end(
&mut self,
_path: &Path,
_matcher_idx: usize,
token: Token
) -> Result<Option<Vec<u8>>, Handler>
[src]
fn end(
&mut self,
_path: &Path,
_matcher_idx: usize,
token: Token
) -> Result<Option<Vec<u8>>, Handler>
[src]Is called when the path is no longer matched Read more
fn is_converter(&self) -> bool
[src]
fn is_converter(&self) -> bool
[src]Should be handler used to convert data