@@ -530,7 +530,7 @@ A decoder needs to implements more substance.
530
530
in the ` elementIndex ` variable. See
531
531
the [ Hand-written composite serializer] ( serializers.md#hand-written-composite-serializer ) section
532
532
on how it ends up being used.
533
- * [ beginStructure] [ Decoder.beginStructure ] &must ; returns a new instance of the ` ListDecoder ` , so that
533
+ * [ beginStructure] [ Decoder.beginStructure ] &mdash ; returns a new instance of the ` ListDecoder ` , so that
534
534
each structure that is being recursively decoded keeps track of its own ` elementIndex ` state separately.
535
535
536
536
``` kotlin
@@ -676,9 +676,9 @@ Project(name=kotlinx.serialization, owner=User(name=kotlin), votes=9000)
676
676
677
677
### Adding collection support
678
678
679
- This basic format, so far, cannot property represent collections. In encodes them, but it does not keep
680
- track on how many elements are there in the collection or where it ends, so it cannot properly decode them.
681
- First, let us add propers support for collections to the encoder by implementing the
679
+ This basic format, so far, cannot properly represent collections. In encodes them, but it does not keep
680
+ track of how many elements are there in the collection or where it ends, so it cannot properly decode them.
681
+ First, let us add proper support for collections to the encoder by implementing the
682
682
[ Encoder.beginCollection] function. The ` beginCollection ` function takes a collection size as a parameter,
683
683
so we encode it to add it to the result.
684
684
Our encoder implementation does not keep any state, so it just returns ` this ` from the ` beginCollection ` function.
@@ -716,7 +716,7 @@ inline fun <reified T> encodeToList(value: T) = encodeToList(serializer(), value
716
716
-->
717
717
718
718
The decoder, for our case, needs to only implement the [ CompositeDecoder.decodeCollectionSize] function
719
- in addition the previous code.
719
+ in addition to the previous code.
720
720
721
721
> The formats that store collection size in advance have to return ` true ` from ` decodeSequentially ` .
722
722
0 commit comments