Clarify generic type behaviour in with
attribute
This commit is contained in:
parent
781f40b061
commit
be92d4da5f
1 changed files with 2 additions and 0 deletions
|
@ -117,6 +117,8 @@ Serde docs: [field](https://serde.rs/field-attrs.html#flatten)
|
|||
|
||||
Set on a field to generate this field's schema as the given type instead of the field's actual type. Serde allows the `with` attribute to refer to any module path, but Schemars requires this to be an actual type which implements `JsonSchema`.
|
||||
|
||||
If the given type has any required generic type parameters, then they must all be explicitly specified in this attribute. Serde frequently allows you to omit them as it can make use of type inference, but unfortunately this is not possible with Schemars. For example, `with = "Vec::<i32>"` will work, but `with = "Vec"` and `with = "Vec::<_>"` will not.
|
||||
|
||||
Serde docs: [field](https://serde.rs/field-attrs.html#with)
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue