1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
//! Avrow is a pure Rust implementation of the [Apache Avro specification](https://avro.apache.org/docs/current/spec.html). //! //! Pleaes refer to the [README](https://github.com/creativcoder/avrow/blob/main/README.md) for an overview. //! For more details on the spec, head over to the [FAQ](https://cwiki.apache.org/confluence/display/AVRO/FAQ). //! //! ## Using the library //! //! Add to your `Cargo.toml`: //!```toml //! [dependencies] //! avrow = "0.2.0" //!``` //! ### A hello world example of reading and writing avro data files //!```rust //! use avrow::{Reader, Schema, Writer, from_value}; //! use std::str::FromStr; //! use anyhow::Error; //! //! fn main() -> Result<(), Error> { //! // Writing data //! //! // Create a schema //! let schema = Schema::from_str(r##""null""##)?; //! // Create writer using schema and provide a buffer to write to //! let mut writer = Writer::new(&schema, vec![])?; //! // Write data using write //! writer.write(())?; //! // or serialize //! writer.serialize(())?; //! // retrieve the underlying buffer using the into_inner method. //! let buf = writer.into_inner()?; //! //! // Reading data //! //! // Create Reader by providing a Read wrapped version of `buf` //! let reader = Reader::new(buf.as_slice())?; //! // Use iterator for reading data in an idiomatic manner. //! for i in reader { //! // reading values can fail due to decoding errors, so the return value of iterator is a Option<Result<Value>> //! // it allows one to examine the failure reason on the underlying avro reader. //! dbg!(&i); //! // This value can be converted to a native Rust type using from_value method from the serde impl. //! let _: () = from_value(&i)?; //! } //! //! Ok(()) //! } //!``` // TODO update logo #![doc( html_favicon_url = "https://raw.githubusercontent.com/creativcoder/avrow/main/assets/avrow_logo.png" )] #![doc( html_logo_url = "https://raw.githubusercontent.com/creativcoder/avrow/main/assets/avrow_logo.png" )] #![deny(missing_docs)] #![recursion_limit = "1024"] #![deny(unused_must_use)] #![deny(rust_2018_idioms)] #![deny(warnings)] mod codec; pub mod config; mod error; mod reader; mod schema; mod serde_avro; mod util; mod value; mod writer; pub use codec::Codec; pub use error::AvrowErr; pub use reader::from_value; pub use reader::Header; pub use reader::Reader; pub use schema::Schema; pub use serde_avro::to_value; pub use value::Record; pub use value::Value; pub use writer::Writer; pub use writer::WriterBuilder;