aerospike / aerospike-client-rust

Rust client for the Aerospike database
https://www.aerospike.com/
Other
82 stars 29 forks source link

Implement std::convert::TryFrom<aerospike::Value> for each variant #124

Closed austinjones closed 1 year ago

austinjones commented 2 years ago

If the aerospike client implemented TryFrom, it would be much easier to unpack Values. It would be much easier to write this:

let field: i64 = value.try_into()?

Rather than this:

let field: i64 = match value {
  Value::Int(v) => Ok(v),
  _ => Err(CustomError::InvalidType)
 }?;
khaf commented 1 year ago

Released in v1.3.0.