pub struct Writer<'a, W> { /* private fields */ }
Expand description

Main interface for writing Avro formatted values.

Implementations

Create a builder for building Writer. On the builder, call .schema(...), .writer(...), .codec(...)(optional), .block_size(...)(optional), .user_metadata(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of Writer.

Creates a Writer given a Schema and something implementing the io::Write trait to write to. No compression Codec will be used.

Creates a Writer with a specific Codec given a Schema and something implementing the io::Write trait to write to.

Get a reference to the Schema associated to a Writer.

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.

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.

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.

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).

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).

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).

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.

Return what the Writer is writing to, consuming the Writer itself.

NOTE This function forces the written data to be flushed (an implicit call to flush is performed).

Adds custom metadata to the file. This method could be used only before adding the first record to the writer.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.