All changes are backward-compatible so far.
All changes are backward compatible.
All changes are backward compatible.
-
A custom
Error
enum has been introduced to replace all existing errors and thefailure
crate 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 onError
variants 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:
DecodeError
ValidationError
DeError
SerError
ParseSchemaError
SchemaResolutionError
must be replaced by
Error
. -
The
ToAvro
trait has been deprecated in favor ofFrom<T>
forValue
implementations.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
ToAvro
trait will result in a deprecation warning. The trait will be removed in future versions. -
The
digest
crate has been updated to version0.9
. If you were using thedigest::Digest
trait 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.