pub struct Serializer { /* private fields */ }
Expand description
Serializer pipe: push T
; pull u8
.
The push
and pull
calls can signify “blocking” – i.e. they’re awaiting the other call – by returning None
.
A Some
returned signifies readiness, holding an impl FnOnce
that you can call to perform the push/pull.
§Example
use serde_pipe::Serializer;
let large_vector = (0..1u64<<30).collect::<Vec<_>>();
let mut serializer = Serializer::new();
serializer.push().unwrap()(large_vector);
while let Some(pull) = serializer.pull() {
let byte = pull();
println!("byte! {}", byte);
}
§Panics
Will panic if dropped while non-empty. In practise this almost always signifies a bug. If you do want to drop it when non-empty, call Serializer::empty()
before dropping it.
Implementations§
Trait Implementations§
Source§impl Debug for Serializer
impl Debug for Serializer
Auto Trait Implementations§
impl Freeze for Serializer
impl RefUnwindSafe for Serializer
impl Send for Serializer
impl Sync for Serializer
impl Unpin for Serializer
impl UnwindSafe for Serializer
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