Skip to content

Commit 99bac5f

Browse files
committed
Added RecursiveType to README; note on valid types
1 parent 239b598 commit 99bac5f

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ A lot of data, especially data designed to be used in many different languages,
5555
- `Map<KeyType, ValueType>` (a mapping of `KeyType` instances to `ValueType` instances)
5656
- `Enum<Type>` (a fixed set of up to 255 `Type`s; useful when only a small subset of `Type` instances represent possible values, especially with `String`s)
5757
- `Choice` (a fixed set of up to 255 types that values can take on)
58+
- `Recursive<Type>` (a type that can reference itself and be used to serialize circular data structures)
5859
- `Optional<Type>` (either `null` or an instance of `Type`)
5960
- `Pointer<Type>` (allows multiple long instances of `Type` with the same bytes to be stored only once)
6061

docs/global.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ <h5>Parameters:</h5>
379379

380380
<dt class="tag-source">Source:</dt>
381381
<dd class="tag-source"><ul class="dummy"><li>
382-
<a href="recursive-registry.js.html">recursive-registry.js</a>, <a href="recursive-registry.js.html#line31">line 31</a>
382+
<a href="recursive-registry.js.html">recursive-registry.js</a>, <a href="recursive-registry.js.html#line36">line 36</a>
383383
</li></ul></dd>
384384

385385

@@ -859,7 +859,7 @@ <h5>Parameters:</h5>
859859

860860
<dt class="tag-source">Source:</dt>
861861
<dd class="tag-source"><ul class="dummy"><li>
862-
<a href="recursive-registry.js.html">recursive-registry.js</a>, <a href="recursive-registry.js.html#line45">line 45</a>
862+
<a href="recursive-registry.js.html">recursive-registry.js</a>, <a href="recursive-registry.js.html#line50">line 50</a>
863863
</li></ul></dd>
864864

865865

@@ -1471,7 +1471,12 @@ <h4 class="name" id="registerType"><span class="type-signature"></span>registerT
14711471

14721472
<div class="description">
14731473
Registers a type under a name so
1474-
the name can be used in a <a href="RecursiveType.html"><code>RecursiveType</code></a>
1474+
the name can be used in a <a href="RecursiveType.html"><code>RecursiveType</code></a>.
1475+
The type must be either an <a href="ArrayType.html"><code>ArrayType</code></a>,
1476+
<a href="MapType.html"><code>MapType</code></a>, <a href="SetType.html"><code>SetType</code></a>, <a href="StructType.html"><code>StructType</code></a>,
1477+
or <a href="TupleType.html"><code>TupleType</code></a> due to implementation limitations.
1478+
If you need to use a different type, wrap it
1479+
in a single-field <a href="StructType.html"><code>StructType</code></a>.
14751480
</div>
14761481

14771482

docs/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ <h2>Data types</h2><ul>
9898
<li><code>Map&lt;KeyType, ValueType&gt;</code> (a mapping of <code>KeyType</code> instances to <code>ValueType</code> instances)</li>
9999
<li><code>Enum&lt;Type&gt;</code> (a fixed set of up to 255 <code>Type</code>s; useful when only a small subset of <code>Type</code> instances represent possible values, especially with <code>String</code>s)</li>
100100
<li><code>Choice</code> (a fixed set of up to 255 types that values can take on)</li>
101+
<li><code>Recursive&lt;Type&gt;</code> (a type that can reference itself and be used to serialize circular data structures)</li>
101102
<li><code>Optional&lt;Type&gt;</code> (either <code>null</code> or an instance of <code>Type</code>)</li>
102103
<li><code>Pointer&lt;Type&gt;</code> (allows multiple long instances of <code>Type</code> with the same bytes to be stored only once)</li>
103104
</ul>

docs/recursive-registry.js.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ <h1 class="page-title">Source: recursive-registry.js</h1>
3838
/** @function
3939
* @name registerType
4040
* @desc Registers a type under a name so
41-
* the name can be used in a {@link RecursiveType}
41+
* the name can be used in a {@link RecursiveType}.
42+
* The type must be either an {@link ArrayType},
43+
* {@link MapType}, {@link SetType}, {@link StructType},
44+
* or {@link TupleType} due to implementation limitations.
45+
* If you need to use a different type, wrap it
46+
* in a single-field {@link StructType}.
4247
* @throws {Error} If a type is already registered under the name
4348
* @param {{type, name}} params
4449
* @param {Type} params.type The type to register

recursive-registry.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ module.exports = {
1010
/** @function
1111
* @name registerType
1212
* @desc Registers a type under a name so
13-
* the name can be used in a {@link RecursiveType}
13+
* the name can be used in a {@link RecursiveType}.
14+
* The type must be either an {@link ArrayType},
15+
* {@link MapType}, {@link SetType}, {@link StructType},
16+
* or {@link TupleType} due to implementation limitations.
17+
* If you need to use a different type, wrap it
18+
* in a single-field {@link StructType}.
1419
* @throws {Error} If a type is already registered under the name
1520
* @param {{type, name}} params
1621
* @param {Type} params.type The type to register

0 commit comments

Comments
 (0)