pub struct StringAdapter { /* private fields */ }
Expand description
An example Adapter
type for producing a chunker that yields String
s.
use regex_chunker::{ByteChunker, StringAdapter};
use std::io::Cursor;
let text = b"One, two, three four. Can I have a little more?";
let c = Cursor::new(text);
let chunks: Vec<_> = ByteChunker::new(c, "[ .,?]+")?
.with_adapter(StringAdapter::default())
.map(|res| res.unwrap())
.collect();
assert_eq!(
&chunks,
&[
"One", "two", "three", "four",
"Can", "I", "have", "a", "little", "more"
].clone()
);
Implementations§
Source§impl StringAdapter
impl StringAdapter
pub fn new(mode: Utf8FailureMode) -> Self
Trait Implementations§
Source§impl Adapter for StringAdapter
impl Adapter for StringAdapter
Source§impl Debug for StringAdapter
impl Debug for StringAdapter
Source§impl Default for StringAdapter
impl Default for StringAdapter
Source§fn default() -> StringAdapter
fn default() -> StringAdapter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StringAdapter
impl RefUnwindSafe for StringAdapter
impl Send for StringAdapter
impl Sync for StringAdapter
impl Unpin for StringAdapter
impl UnwindSafe for StringAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more