All changes are backward-compatible so far.
All changes are backward compatible.
All changes are backward compatible.
-
A custom
Errorenum has been introduced to replace all existing errors and thefailurecrate has been replaced bythiserror.This means that all public functions returning
Result<T, failure::Error>will now returnResult<T, avro::Error>and that you can pattern match onErrorvariants if you want to gather more information about the error.For example, code that used to be like this:
match decoded { Ok(msg) => Ok(msg.to_string()), // assuming you were reading a Duration Err(ref e) => match e.downcast_ref::<SchemaResolutionError>() { Some(_) => Ok("default".to_string()), None => Err(format!("Unexpected error: {}", e)), }, }
now becomes:
match decoded { Ok(msg) => Ok(msg.to_string()), Err(Error::ReadDuration(_)) => Ok("default".to_string()), Err(e) => Err(format!("Unexpected error: {}", e)), }
Please note that all instances of:
DecodeErrorValidationErrorDeErrorSerErrorParseSchemaErrorSchemaResolutionError
must be replaced by
Error. -
The
ToAvrotrait has been deprecated in favor ofFrom<T>forValueimplementations.Code like the following:
use crate::types::{Record, ToAvro, Value}; let expected: Value = record.avro();
should be updated to:
use crate::types::{Record, Value}; let expected: Value = record.into();
Using the
ToAvrotrait will result in a deprecation warning. The trait will be removed in future versions. -
The
digestcrate has been updated to version0.9. If you were using thedigest::Digesttrait from version0.8, you must update to the one defined in0.9.
-
Writer::into_inner()now callsflush()and returns aResult.This means that code like
writer.append_ser(test)?; writer.flush()?; let input = writer.into_inner();
can be simplified into
writer.append_ser(test)?; let input = writer.into_inner()?;
There is no harm in leaving old calls to
flush()around.