Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
223 changes: 0 additions & 223 deletions avro/src/bytes.rs

This file was deleted.

3 changes: 3 additions & 0 deletions avro/src/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ impl Codec {
pub mod bzip {
use bzip2::Compression;

/// Settings for configuring bzip2 compression.
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
pub struct Bzip2Settings {
pub compression_level: u8,
Expand All @@ -279,6 +280,7 @@ pub mod bzip {

#[cfg(feature = "zstandard")]
pub mod zstandard {
/// Settings for configuring zstandard compression.
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
pub struct ZstandardSettings {
pub compression_level: u8,
Expand All @@ -299,6 +301,7 @@ pub mod zstandard {

#[cfg(feature = "xz")]
pub mod xz {
/// Settings for configuring xz compression.
#[derive(Clone, Copy, Eq, PartialEq, Debug)]
pub struct XzSettings {
pub compression_level: u8,
Expand Down
1 change: 1 addition & 0 deletions avro/src/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use num_bigint::{BigInt, Sign};
use serde::{Deserialize, Serialize, Serializer, de::SeqAccess};
use std::num::NonZero;

/// A decimal as specified in the Avro specification.
#[derive(Debug, Clone, Eq)]
pub struct Decimal {
value: BigInt,
Expand Down
17 changes: 2 additions & 15 deletions avro/src/documentation/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,6 @@
//!
//! ```
//! use apache_avro::{Codec, DeflateSettings, Reader, Schema, Writer, from_value, types::Record, Error};
//! use serde::{Deserialize, Serialize};
//!
//! #[derive(Debug, Deserialize, Serialize)]
//! struct Test {
//! a: i64,
//! b: String,
//! }
//!
//! fn main() -> Result<(), Error> {
//! let raw_schema = r#"
Expand All @@ -260,18 +253,12 @@
//!
//! writer.append_value(record)?;
//!
//! let test = Test {
//! a: 27,
//! b: "foo".to_owned(),
//! };
//!
//! writer.append_ser(test)?;
//!
//! let input = writer.into_inner()?;
//! let reader = Reader::builder(&input[..]).reader_schema(&schema).build()?;
//!
//! for record in reader {
//! println!("{:?}", from_value::<Test>(&record?));
//! let record = record?;
//! println!("{record:?}");
//! }
//! Ok(())
//! }
Expand Down
6 changes: 2 additions & 4 deletions avro/src/documentation/primer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@
//! schema and can therefore not be decoded without the reader knowing **exactly** which schema was
//! used to write it.
//!
//! This file format can be used via the [`to_avro_datum`](crate::to_avro_datum), [`from_avro_datum`](crate::from_avro_datum),
//! [`to_avro_datum_schemata`](crate::to_avro_datum_schemata), [`from_avro_datum_schemata`](crate::from_avro_datum_schemata),
//! [`from_avro_datum_reader_schemata`](crate::from_avro_datum_reader_schemata), and
//! [`write_avro_datum_ref`](crate::write_avro_datum_ref) functions.
//! This file format can be used via the [`GenericDatumWriter`](crate::writer::datum::GenericDatumWriter)
//! and [`GenericDatumReader`](crate::reader::datum::GenericDatumReader) functions.
//!
//! #### [Avro JSON](https://avro.apache.org/docs/++version++/specification/#json-encoding)
//! Not be confused with the schema definition which is also in JSON. This is the Avro data encoded
Expand Down
6 changes: 4 additions & 2 deletions avro/src/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

use serde::{Deserialize, Serialize, de};

/// A struct representing duration that hides the details of endianness and conversion between
/// platform-native u32 and byte arrays.
/// A duration as specified in the Avro specification.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Duration {
months: Months,
days: Days,
millis: Millis,
}

/// The months part of a duration as specified in the Avro specification.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Months(u32);

Expand All @@ -51,6 +51,7 @@ impl From<[u8; 4]> for Months {
}
}

/// The days part of a duration as specified in the Avro specification.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Days(u32);

Expand All @@ -76,6 +77,7 @@ impl From<[u8; 4]> for Days {
}
}

/// The milliseconds part of a duration as specified in the Avro specification.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct Millis(u32);

Expand Down
27 changes: 2 additions & 25 deletions avro/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// specific language governing permissions and limitations
// under the License.

//! Types for dealing with errors.

use crate::{
schema::{Name, RecordSchema, Schema, SchemaKind, UnionSchema},
types::{Value, ValueKind},
Expand Down Expand Up @@ -375,10 +377,6 @@ pub enum Details {
#[error("Cannot convert u64 to usize: {1}")]
ConvertU64ToUsize(#[source] std::num::TryFromIntError, u64),

#[deprecated(since = "0.20.0", note = "This error variant is not generated anymore")]
#[error("Cannot convert u32 to usize: {1}")]
ConvertU32ToUsize(#[source] std::num::TryFromIntError, u32),

#[error("Cannot convert i64 to usize: {1}")]
ConvertI64ToUsize(#[source] std::num::TryFromIntError, i64),

Expand Down Expand Up @@ -433,20 +431,12 @@ pub enum Details {
#[error("The decimal precision ({precision}) must be a non-zero positive number")]
DecimalPrecisionMuBePositive { precision: usize },

#[deprecated(since = "0.20.0", note = "This error variant is not generated anymore")]
#[error("Unreadable big decimal sign")]
BigDecimalSign,

#[error("Unreadable length for big decimal inner bytes: {0}")]
BigDecimalLen(#[source] Box<Error>),

#[error("Unreadable big decimal scale")]
BigDecimalScale,

#[deprecated(since = "0.20.0", note = "This error variant is not generated anymore")]
#[error("Unexpected `type` {0} variant for `logicalType`")]
GetLogicalTypeVariant(serde_json::Value),

#[error("No `type` field found for `logicalType`")]
GetLogicalTypeField,

Expand Down Expand Up @@ -545,19 +535,6 @@ pub enum Details {
#[error("Expected a string for the `{0}` field, got a {1}")]
GetStringInvalidType(&'static str, &'static str),

#[deprecated(since = "0.22.0", note = "This error variant is not generated anymore")]
#[error("Fixed schema's default value length ({0}) does not match its size ({1})")]
FixedDefaultLenSizeMismatch(usize, u64),

#[deprecated(since = "0.20.0", note = "This error variant is not generated anymore")]
#[error("Failed to compress with flate: {0}")]
DeflateCompress(#[source] std::io::Error),

// no longer possible after migration from libflate to miniz_oxide
#[deprecated(since = "0.19.0", note = "This error can no longer occur")]
#[error("Failed to finish flate compressor: {0}")]
DeflateCompressFinish(#[source] std::io::Error),

#[error("Failed to decompress with flate: {0}")]
DeflateDecompress(#[source] std::io::Error),

Expand Down
Loading
Loading