| OLD | NEW |
| 1 # Mojom IDL and Bindings Generator | 1 # Mojom IDL and Bindings Generator |
| 2 This document is a subset of the [Mojo documentation](/mojo). | 2 This document is a subset of the [Mojo documentation](/mojo). |
| 3 | 3 |
| 4 [TOC] | 4 [TOC] |
| 5 | 5 |
| 6 ## Overview | 6 ## Overview |
| 7 | 7 |
| 8 Mojom is the IDL for Mojo bindings interfaces. Given a `.mojom` file, the | 8 Mojom is the IDL for Mojo bindings interfaces. Given a `.mojom` file, the |
| 9 [bindings generator](https://cs.chromium.org/chromium/src/mojo/public/tools/bind
ings) | 9 [bindings generator](https://cs.chromium.org/chromium/src/mojo/public/tools/bind
ings) |
| 10 outputs bindings for all supported languages: **C++**, **JavaScript**, and | 10 outputs bindings for all supported languages: **C++**, **JavaScript**, and |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 Mojom supports tagged unions using the **union** keyword. A union is a | 261 Mojom supports tagged unions using the **union** keyword. A union is a |
| 262 collection of fields which may taken the value of any single one of those fields | 262 collection of fields which may taken the value of any single one of those fields |
| 263 at a time. Thus they provide a way to represent a variant value type while | 263 at a time. Thus they provide a way to represent a variant value type while |
| 264 minimizing storage requirements. | 264 minimizing storage requirements. |
| 265 | 265 |
| 266 Union fields may be of any type supported by [struct](#Structs) fields. For | 266 Union fields may be of any type supported by [struct](#Structs) fields. For |
| 267 example: | 267 example: |
| 268 | 268 |
| 269 ```cpp | 269 ```cpp |
| 270 enum ExampleUnion { | 270 union ExampleUnion { |
| 271 string str; | 271 string str; |
| 272 StringPair pair; | 272 StringPair pair; |
| 273 int64 id; | 273 int64 id; |
| 274 array<uint64, 2> guid; | 274 array<uint64, 2> guid; |
| 275 SampleInterface iface; | 275 SampleInterface iface; |
| 276 }; | 276 }; |
| 277 ``` | 277 ``` |
| 278 | 278 |
| 279 For details on how unions like this translate to generated bindings code, see | 279 For details on how unions like this translate to generated bindings code, see |
| 280 [documentation for individual target languages](#Generated-Code-For-Target-Langu
ages). | 280 [documentation for individual target languages](#Generated-Code-For-Target-Langu
ages). |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 763 |
| 764 ## Additional Documentation | 764 ## Additional Documentation |
| 765 | 765 |
| 766 [Mojom Message Format](https://docs.google.com/document/d/13pv9cFh5YKuBggDBQ1-AL
8VReF-IYpFOFpRfvWFrwio/edit) | 766 [Mojom Message Format](https://docs.google.com/document/d/13pv9cFh5YKuBggDBQ1-AL
8VReF-IYpFOFpRfvWFrwio/edit) |
| 767 : Describes the wire format used by Mojo bindings interfaces over message | 767 : Describes the wire format used by Mojo bindings interfaces over message |
| 768 pipes. | 768 pipes. |
| 769 | 769 |
| 770 [Input Format of Mojom Message Validation Tests](https://docs.google.com/documen
t/d/1-y-2IYctyX2NPaLxJjpJfzVNWCC2SR2MJAD9MpIytHQ/edit) | 770 [Input Format of Mojom Message Validation Tests](https://docs.google.com/documen
t/d/1-y-2IYctyX2NPaLxJjpJfzVNWCC2SR2MJAD9MpIytHQ/edit) |
| 771 : Describes a text format used to facilitate bindings message validation | 771 : Describes a text format used to facilitate bindings message validation |
| 772 tests. | 772 tests. |
| OLD | NEW |