Skip to content

Commit 7054f93

Browse files
committed
Docs
1 parent f43f9fc commit 7054f93

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,9 @@ happen at any depth level. For example, a field of type `A =
650650
Vec<Vec<Vec<usize>>>` will be deserialized as a `A = Vec<Vec<&[usize]>>`. Note,
651651
however, that field types are not replaced if they are not type parameters: a
652652
field of type `Vec<T>` will always be deserialized as a `Vec<T>`, even if `T` is
653-
[`ZeroCopy`].
653+
[`ZeroCopy`]. In particular, you cannot have `T` both as the type of a field and
654+
as a type parameter of another field (but see the exception below for
655+
[`PhantomData`]).
654656

655657
This approach makes it possible to write ε-serde-aware structures that hide from
656658
the user the substitution. A good example is the `BitFieldVec` structure from
@@ -668,8 +670,7 @@ notice the difference if you access both versions using the trait
668670

669671
[`PhantomData`] undergoes a special treatment: its type parameter `T` does not
670672
have to be (de)serializable or sized—it is sufficient that it implements
671-
[`TypeHash`]. Moreover, `T` is not replaced with its associated
672-
(de)serialization type.
673+
[`TypeHash`].
673674

674675
There might be corner cases in which `T` appears both as a parameter of
675676
[`PhantomData`] and as a type parameter of a field of a type. In this case, you

0 commit comments

Comments
 (0)