diff --git a/docs/source/data-types/udt.md b/docs/source/data-types/udt.md index 4a8f91b13..ddafb748e 100644 --- a/docs/source/data-types/udt.md +++ b/docs/source/data-types/udt.md @@ -20,13 +20,14 @@ and `DeserializeValue` macros documentation. ```rust # extern crate scylla; # async fn check_only_compiles() { -use scylla::macros::{FromUserType, SerializeValue}; +use scylla::macros::{DeserializeValue, SerializeValue}; // Define a custom struct that matches the User Defined Type created earlier. -// Fields must be in the same order as they are in the database and also -// have the same names. +// Fields don't have to be in the same order as they are in the database. +// By default, they must have the same names, but this can be worked around +// using `#[rename] field attribute. // Wrapping a field in Option will gracefully handle null field values. -#[derive(Debug, FromUserType, SerializeValue)] +#[derive(Debug, DeserializeValue, SerializeValue)] struct MyType { int_val: i32, text_val: Option, diff --git a/docs/source/migration-guides/0.11-serialization.md b/docs/source/migration-guides/0.11-serialization.md index 77004b03d..601be0da2 100644 --- a/docs/source/migration-guides/0.11-serialization.md +++ b/docs/source/migration-guides/0.11-serialization.md @@ -42,8 +42,6 @@ The driver comes a set of `impl`s of those traits which allow to represent any C By default, the `SerializeRow` and `SerializeValue` **will match the fields in the Rust struct by name to bind marker names** (in case of `SerializeRow`) **or UDT field names** (in case of `SerializeValue`). This is different from the old `ValueList` and `IntoUserType` macros which did not look at the field names at all and would expect the user to order the fields correctly. While the new behavior is much more ergonomic, you might have reasons not to use it. -> **NOTE:** The deserialization macro counterparts `FromRow` and `FromUserType` have the same limitation as the old serialization macros - they require struct fields to be properly ordered. While a similar rework is planned for the deserialization traits in a future release, for the time being it might not be worth keeping the column names in sync with the database. - In order to bring the old behavior to the new macros (the only difference being type checking which cannot be disabled right now) you can configure it using attributes, as shown in the snippet below: ```rust