[−][src]Struct avro_rs::Writer
Main interface for writing Avro formatted values.
Methods
impl<'a, W: Write> Writer<'a, W>
[src]
pub fn new(schema: &'a Schema, writer: W) -> Writer<'a, W>
[src]
Creates a Writer
given a Schema
and something implementing the io::Write
trait to write
to.
No compression Codec
will be used.
pub fn with_codec(schema: &'a Schema, writer: W, codec: Codec) -> Writer<'a, W>
[src]
Creates a Writer
with a specific Codec
given a Schema
and something implementing the
io::Write
trait to write to.
pub fn schema(&self) -> &'a Schema
[src]
Get a reference to the Schema
associated to a Writer
.
pub fn append<T: ToAvro>(&mut self, value: T) -> Result<usize, Error>
[src]
Append a compatible value (implementing the ToAvro
trait) to a Writer
, also performing
schema validation.
Return the number of bytes written (it might be 0, see below).
NOTE This function is not guaranteed to perform any actual write, since it relies on
internal buffering for performance reasons. If you want to be sure the value has been
written, then call flush
.
pub fn append_value_ref(&mut self, value: &Value) -> Result<usize, Error>
[src]
Append a compatible value to a Writer
, also performing schema validation.
Return the number of bytes written (it might be 0, see below).
NOTE This function is not guaranteed to perform any actual write, since it relies on
internal buffering for performance reasons. If you want to be sure the value has been
written, then call flush
.
pub fn append_ser<S: Serialize>(&mut self, value: S) -> Result<usize, Error>
[src]
Append anything implementing the Serialize
trait to a Writer
for
serde
compatibility, also performing schema
validation.
Return the number of bytes written.
NOTE This function is not guaranteed to perform any actual write, since it relies on
internal buffering for performance reasons. If you want to be sure the value has been
written, then call flush
.
pub fn extend<I, T: ToAvro>(&mut self, values: I) -> Result<usize, Error> where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
Extend a Writer
with an Iterator
of compatible values (implementing the ToAvro
trait), also performing schema validation.
Return the number of bytes written.
NOTE This function forces the written data to be flushed (an implicit
call to flush
is performed).
pub fn extend_ser<I, T: Serialize>(&mut self, values: I) -> Result<usize, Error> where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
Extend a Writer
with an Iterator
of anything implementing the Serialize
trait for
serde
compatibility, also performing schema
validation.
Return the number of bytes written.
NOTE This function forces the written data to be flushed (an implicit
call to flush
is performed).
pub fn extend_from_slice(&mut self, values: &[Value]) -> Result<usize, Error>
[src]
Extend a Writer
by appending each Value
from a slice, while also performing schema
validation on each value appended.
Return the number of bytes written.
NOTE This function forces the written data to be flushed (an implicit
call to flush
is performed).
pub fn flush(&mut self) -> Result<usize, Error>
[src]
Flush the content appended to a Writer
. Call this function to make sure all the content
has been written before releasing the Writer
.
Return the number of bytes written.
pub fn into_inner(self) -> W
[src]
Return what the Writer
is writing to, consuming the Writer
itself.
NOTE This function doesn't guarantee that everything gets written before consuming the
buffer. Please call flush
before.
Auto Trait Implementations
impl<'a, W> RefUnwindSafe for Writer<'a, W> where
W: RefUnwindSafe,
W: RefUnwindSafe,
impl<'a, W> Send for Writer<'a, W> where
W: Send,
W: Send,
impl<'a, W> Sync for Writer<'a, W> where
W: Sync,
W: Sync,
impl<'a, W> Unpin for Writer<'a, W> where
W: Unpin,
W: Unpin,
impl<'a, W> UnwindSafe for Writer<'a, W> where
W: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,