File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -650,7 +650,9 @@ happen at any depth level. For example, a field of type `A =
650
650
Vec<Vec<Vec<usize >>>` will be deserialized as a ` A = Vec<Vec<&[ usize] >>`. Note,
651
651
however, that field types are not replaced if they are not type parameters: a
652
652
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 ` ] ).
654
656
655
657
This approach makes it possible to write ε-serde-aware structures that hide from
656
658
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
668
670
669
671
[ ` PhantomData ` ] undergoes a special treatment: its type parameter ` T ` does not
670
672
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 ` ] .
673
674
674
675
There might be corner cases in which ` T ` appears both as a parameter of
675
676
[ ` PhantomData ` ] and as a type parameter of a field of a type. In this case, you
You can’t perform that action at this time.
0 commit comments