Skip to content

Commit 32f6078

Browse files
committed
Documentation fixes and lints
1 parent d2f8037 commit 32f6078

File tree

6 files changed

+44
-45
lines changed

6 files changed

+44
-45
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: ci
2+
13
on: [push, pull_request]
24

35
jobs:

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div align="center">
22
<img alt="avrow" width="250" src="assets/avrow_logo.png" />
33

4-
[![github actions](https://github.com/creativcoder/avrow/workflows/Rust/badge.svg)](https://github.com/creativcoder/avrow/actions)
5-
[![crates](https://img.shields.io/crates/v/avrow.svg)](https://crates.io/crates/io-uring)
4+
[![Actions Status](https://github.com/creativcoder/avrow/workflows/ci/badge.svg)](https://github.com/creativcoder/avrow/actions)
5+
[![crates](https://img.shields.io/crates/v/avrow.svg)](https://crates.io/crates/avrow)
66
[![docs.rs](https://docs.rs/avrow/badge.svg)](https://docs.rs/avrow/)
77
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/creativcoder/avrow/blob/master/LICENSE-MIT)
88
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/creativcoder/avrow/blob/master/LICENSE-APACHE)
@@ -81,7 +81,7 @@ Add avrow as a dependency to `Cargo.toml`:
8181

8282
```toml
8383
[dependencies]
84-
avrow = "0.1"
84+
avrow = "0.1.0"
8585
```
8686

8787
## Examples:
@@ -112,7 +112,7 @@ fn main() -> Result<(), Error> {
112112
}
113113

114114
```
115-
For simple and native Rust types, avrow provides a `From` impl for Avro value types. For compound or user defined types (structs, enums), one can use the `serialize` method which relies on serde. Alternatively, one can construct `avrow::Value` instances which is a more verbose way to write avro values and should be a last resort.
115+
For simple and native Rust types, avrow provides a `From` impl to convert to Avro value types. For compound or user defined types (structs or enums), one can use the `serialize` method which relies on serde. Alternatively, one can construct `avrow::Value` instances which is a more verbose way to write avro values and should be a last resort.
116116

117117
### Reading avro data
118118

benches/write.rs

-1
This file was deleted.

src/lib.rs

+37-34
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,54 @@
1212
//! ### A hello world example of reading and writing avro data files
1313
1414
//!```rust
15-
//!use avrow::{Reader, Schema, Writer, from_value};
16-
//!use std::str::FromStr;
17-
//!use std::error::Error;
15+
//! use avrow::{Reader, Schema, Writer, from_value};
16+
//! use std::str::FromStr;
17+
//! use anyhow::Error;
1818
//!
19-
//!use std::io::Cursor;
19+
//! fn main() -> Result<(), Error> {
20+
//! // Writing data
2021
//!
21-
//!fn main() -> Result<(), Box<dyn Error>> {
22-
//! // Writing data
22+
//! // Create a schema
23+
//! let schema = Schema::from_str(r##""null""##)?;
24+
//! // Create writer using schema and provide a buffer to write to
25+
//! let mut writer = Writer::new(&schema, vec![])?;
26+
//! // Write data using write
27+
//! writer.write(())?;
28+
//! // or serialize
29+
//! writer.serialize(())?;
30+
//! // retrieve the underlying buffer using the into_inner method.
31+
//! let buf = writer.into_inner()?;
2332
//!
24-
//! // Create a schema
25-
//! let schema = Schema::from_str(r##""null""##)?;
26-
//! // Create writer using schema and provide a buffer to write to
27-
//! let mut writer = Writer::new(&schema, vec![])?;
28-
//! // Write the data using append
29-
//! writer.serialize(())?;
30-
//! // or serialize
31-
//! writer.serialize(())?;
32-
//! // retrieve the underlying buffer using the into_inner method.
33-
//! let buf = writer.into_inner()?;
33+
//! // Reading data
3434
//!
35-
//! // Reading data
36-
//!
37-
//! // Create Reader by providing a Read wrapped version of `buf`
38-
//! let reader = Reader::new(buf.as_slice())?;
39-
//! // Use iterator for reading data in an idiomatic manner.
40-
//! for i in reader {
41-
//! // reading values can fail due to decoding errors, so the return value of iterator is a Option<Result<Value>>
42-
//! // it allows one to examine the failure reason on the underlying avro reader.
43-
//! dbg!(&i);
44-
//! // This value can be converted to a native Rust type using from_value method from the serde impl.
45-
//! let _: () = from_value(&i)?;
46-
//! }
47-
//!
48-
//! Ok(())
49-
//!}
35+
//! // Create Reader by providing a Read wrapped version of `buf`
36+
//! let reader = Reader::new(buf.as_slice())?;
37+
//! // Use iterator for reading data in an idiomatic manner.
38+
//! for i in reader {
39+
//! // reading values can fail due to decoding errors, so the return value of iterator is a Option<Result<Value>>
40+
//! // it allows one to examine the failure reason on the underlying avro reader.
41+
//! dbg!(&i);
42+
//! // This value can be converted to a native Rust type using from_value method from the serde impl.
43+
//! let _: () = from_value(&i)?;
44+
//! }
5045
//!
46+
//! Ok(())
47+
//! }
48+
5149
//!```
5250
5351
// TODO update logo
54-
#![doc(html_favicon_url = "")]
55-
#![doc(html_logo_url = "assets/avrow_logo.png")]
52+
#![doc(
53+
html_favicon_url = "https://raw.githubusercontent.com/creativcoder/avrow/main/assets/avrow_logo.png"
54+
)]
55+
#![doc(
56+
html_logo_url = "https://raw.githubusercontent.com/creativcoder/avrow/main/assets/avrow_logo.png"
57+
)]
5658
#![deny(missing_docs)]
5759
#![recursion_limit = "1024"]
5860
#![deny(unused_must_use)]
59-
// #![deny(warnings)]
61+
#![deny(rust_2018_idioms)]
62+
#![deny(warnings)]
6063

6164
mod codec;
6265
pub mod config;

src/reader.rs

-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ use value::{FieldValue, Record, Value};
2828
pub struct Reader<R> {
2929
source: R,
3030
header: Header,
31-
// TODO when reading data call resolve schema https://avro.apache.org/docs/1.8.2/spec.html#Schema+Resolution
32-
// This is the schema after it has been resolved using both reader and writer schema
33-
// NOTE: This is a partially resolved schema
34-
// schema: Option<ResolvedSchema>,
35-
// TODO this is for experimental purposes, ideally we can just use references
3631
reader_schema: Option<Schema>,
3732
block_buffer: Cursor<Vec<u8>>,
3833
entries_in_block: u64,

src/schema/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl Name {
188188
}
189189

190190
impl Display for Name {
191-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
191+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
192192
if let Some(ref namespace) = self.namespace {
193193
write!(f, "{}.{}", namespace, self.name)
194194
} else {

0 commit comments

Comments
 (0)