cargo diesel 1.1.0

latest releases: 2.0.3, 2.0.2, 2.0.1...
6 years ago

Improved Support for Adding New Types

The primary focus of this release was improving the ergonomics of adding support for new types in Diesel.

For implementing new SQL types, we've added #[derive(SqlType)] which implements many traits that you need to implement for every SQL type. See the documentation for HasSqlType for details on this derive.

For implementing new mappings, we've added #[derive(FromSqlRow)] and #[derive(AsExpression)]. These derives will replace the majority of the boilerplate that was previously required when supporting new types. Adding support for new types in Diesel 1.1 should only require implementing FromSql and ToSql. The derives will handle the rest.

We've also provided FromSql impls for *const str and *const [u8]. Due to the design of FromSql, we can't provide impls for &str and &[u8] without a breaking change. However many impls just need to parse a string or some bytes, and don't need the allocation that would come from String or Vec<u8>. This will require unsafe code to use, but should make certain implementations more efficient.

Finally, we've restructured how our serialize/deserialize modules are structured, and provided type aliases to make implementations of FromSql and ToSql more consise.

r2d2_diesel is Now Part of Diesel

Finally, this release merges r2d2_diesel into Diesel itself. The main benefit of doing this is that we can implement Connection for PooledConnection, removing the need for explicit &* when using r2d2. This should also help to prevent version mismatches when changing Diesel versions.

To use the new r2d2 support, remove r2d2 and r2d2_diesel from your Cargo.toml. Add the r2d2 to your enabled features on diesel. Replace extern crate r2d2 with pub use diesel::r2d2. Replace any r2d2_diesel:: with diesel::r2d2::.

Thanks

In addition to the headline features, there were dozens of smaller additions which should make using Diesel even better! As always, you can check the CHANGELOG for a full list of changes in this release.

In addition to the Diesel core team, 8 people contributed to this release. A huge thank you to:

  • Ashe Connor
  • Chris Pick
  • Evan
  • Georg Semmler
  • MarcManiez
  • Martin Lindhe
  • Oliver Schneider
  • Ryan Blecher

Don't miss a new diesel release

NewReleases is sending notifications on new releases.