Mojo docs: improve visibility of MinVersion note
Prior to this CL, the note that MinVersion required non-primitive types to be nullable in structs was after the discussion of ordinality for struct fields. After this CL, that requirement is mentioned near the beginning of the discussion about struct field versioning to make it more discoverable. I also did a few drive-by typo fixes. Bug: N/A Change-Id: Iad906ab2d1278f5855590f18c1aff4c394586852 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2881026 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#880685}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
0aa874076f
commit
ddcf4ddf5a
@ -320,7 +320,7 @@ enum definition. By default, values are based at zero and increment by
|
||||
1 sequentially.
|
||||
|
||||
The effect of nested definitions on generated bindings varies depending on the
|
||||
target language. See [documentation for individual target languages](#Generated-Code-For-Target-Languages)
|
||||
target language. See [documentation for individual target languages](#Generated-Code-For-Target-Languages).
|
||||
|
||||
### Constants
|
||||
|
||||
@ -346,7 +346,7 @@ struct Employee {
|
||||
```
|
||||
|
||||
The effect of nested definitions on generated bindings varies depending on the
|
||||
target language. See [documentation for individual target languages](#Generated-Code-For-Target-Languages)
|
||||
target language. See [documentation for individual target languages](#Generated-Code-For-Target-Languages).
|
||||
|
||||
### Interfaces
|
||||
|
||||
@ -579,7 +579,8 @@ struct Employee {
|
||||
};
|
||||
```
|
||||
|
||||
and you would like to add birthday and nickname fields. You can do:
|
||||
and you would like to add birthday and nickname fields. You can add them as
|
||||
optional types with a `MinVersion` like so:
|
||||
|
||||
``` cpp
|
||||
struct Employee {
|
||||
@ -590,6 +591,12 @@ struct Employee {
|
||||
};
|
||||
```
|
||||
|
||||
*** note
|
||||
**NOTE:** Mojo object or handle types added with a `MinVersion` **MUST** be
|
||||
optional (nullable). See [Primitive Types](#Primitive-Types) for details on
|
||||
nullable values.
|
||||
***
|
||||
|
||||
By default, fields belong to version 0. New fields must be appended to the
|
||||
struct definition (*i.e*., existing fields must not change **ordinal value**)
|
||||
with the `MinVersion` attribute set to a number greater than any previous
|
||||
@ -635,11 +642,6 @@ struct Employee {
|
||||
};
|
||||
```
|
||||
|
||||
*** note
|
||||
**NOTE:** Newly added fields of Mojo object or handle types MUST be nullable.
|
||||
See [Primitive Types](#Primitive-Types).
|
||||
***
|
||||
|
||||
### Versioned Interfaces
|
||||
|
||||
There are two dimensions on which an interface can be extended
|
||||
|
Reference in New Issue
Block a user