The example parses the people document in your selected format.
It then reads Ada's age through the document nodes.
Typed reads give you these values without serializing the document.
people_text holds this document:
TRON449 B
Offset (hex) Bytes (hex) Meaning 000 54 52 4F 4E magic TRON 004 3C 616765 txt "age" 008 02 24000000000000
00 i64 36 011 0F 0A 04000000 0800
0000 map leaf, size 10: @4 → @8 01B 4C 726F6C65 txt "role" 020 8C 656E67696E6565
72 txt "engineer" 029 0F 0A 1B000000 2000
0000 map leaf, size 10: @1B → @20 033 4C 6E616D65 txt "name" 038 3C 416461 txt "Ada" 03C 0F 0A 33000000 3800
0000 map leaf, size 10: @33 → @38 046 07 12 00910000 1100
0000 29000000 3C00
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C 058 5C 236C696E6B txt "#link" 05E 5C 235F616461 txt "#_ada" 064 0F 0A 58000000 5E00
0000 map leaf, size 10: @58 → @5E 06E 3C 616765 txt "age" 072 02 29000000000000
00 i64 41 07B 0F 0A 6E000000 7200
0000 map leaf, size 10: @6E → @72 085 6C 6D656E746F72 txt "mentor" 08C 0F 0A 85000000 6400
0000 map leaf, size 10: @85 → @64 096 4C 726F6C65 txt "role" 09B 8C 656E67696E6565
72 txt "engineer" 0A4 0F 0A 96000000 9B00
0000 map leaf, size 10: @96 → @9B 0AE 4C 6E616D65 txt "name" 0B3 3C 426F62 txt "Bob" 0B7 0F 0A AE000000 B300
0000 map leaf, size 10: @AE → @B3 0C1 07 16 00990000 7B00
0000 8C000000 A400
0000 B7000000 map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7 0D7 3C 616765 txt "age" 0DB 02 1D000000000000
00 i64 29 0E4 0F 0A D7000000 DB00
0000 map leaf, size 10: @D7 → @DB 0EE 4C 726F6C65 txt "role" 0F3 8C 64657369676E65
72 txt "designer" 0FC 0F 0A EE000000 F300
0000 map leaf, size 10: @EE → @F3 106 4C 6E616D65 txt "name" 10B 2C 4379 txt "Cy" 10E 0F 0A 06010000 0B01
0000 map leaf, size 10: @106 → @10B 118 07 12 00910000 E400
0000 FC000000 0E01
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E 12A 6C 617574686F72 txt "author" 131 5C 736D6F6B65 txt "smoke" 137 0F 0A 2A010000 3101
0000 map leaf, size 10: @12A → @131 141 6C 726561736F6E txt "reason" 148 4C 73656564 txt "seed" 14D 0F 0A 41010000 4801
0000 map leaf, size 10: @141 → @148 157 07 0E 40080000 3701
0000 4D010000 map branch, size 14, depth 0 (root), slots 6, 11: @137 → @14D 165 4C 235F7478 txt "#_tx" 16A 0F 0A 65010000 5701
0000 map leaf, size 10: @165 → @157 174 4C 235F6379 txt "#_cy" 179 0F 0A 74010000 1801
0000 map leaf, size 10: @174 → @118 183 5C 235F626F62 txt "#_bob" 189 0F 0A 83010000 C100
0000 map leaf, size 10: @183 → @C1 193 5C 235F616461 txt "#_ada" 199 0F 0A 93010000 4600
0000 map leaf, size 10: @193 → @46 1A3 07 16 88210000 6A01
0000 79010000 8901
0000 99010000 map branch, size 22, depth 0 (root), slots 3, 7, 8, 13: @16A → @179 → @189 → @199
python 196 B
async with (await stardust .parse (people_text , "tron" )) as people :
ada = (await people .member ((await people .root ()), "#_ada" ))
result = (await people .i64 ((await people .member (ada , "age" ))))
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 24000000000000
00 i64 36
A document number is an i64 integer or a finite f64 value. The number type defines both.
An integer read requires an integer node. A floating-point node can cause the read to fail.
Choose the typed read that matches the node that you read.
python 84 B
def parse (text : str | bytes , format : str , * , library : str | None = None ) -> Document
expression_text holds these bytes:
text 278 B
// One expression built once and evaluated against several inputs. The
// evaluate examples load this file, build `expression`, evaluate it with each
// of `inputs` in order and compare each result with `expected`.
expression [+ ?x 1]
inputs [{x 1} {x 41}]
expected [2 42]
python 56 B
result = (await stardust .parse (expression_text , "dust" ))
TRON466 B
Offset (hex) Bytes (hex) Meaning 000 54 52 4F 4E magic TRON 004 1C 2B txt "+" 006 2C 3F78 txt "?x" 009 02 01000000000000
00 i64 1 012 0E 15 00 0700 030000
00 04000000 060000
00 09000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @9 027 1C 78 txt "x" 029 02 01000000000000
00 i64 1 032 0F 0A 27000000 2900
0000 map leaf, size 10: @27 → @29 03C 1C 78 txt "x" 03E 02 29000000000000
00 i64 41 047 0F 0A 3C000000 3E00
0000 map leaf, size 10: @3C → @3E 051 0E 11 00 0300 020000
00 32000000 470000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @32 → @47 062 02 02000000000000
00 i64 2 06B 02 2A000000000000
00 i64 42 074 0E 11 00 0300 020000
00 62000000 6B0000
00 array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @62 → @6B 085 8C 24636F6D6D656E
74 txt "$comment" 08E 14 CD 4F6E65206578
7072657373696F6E
206275696C74206F
6E636520616E6420
6576616C75617465
6420616761696E73
7420736576657261
6C20696E70757473
2E205468650A6576
616C756174652065
78616D706C657320
6C6F616420746869
732066696C652C20
6275696C64206065
787072657373696F
6E602C206576616C
7561746520697420
7769746820656163
680A6F662060696E
707574736020696E
206F726465722061
6E6420636F6D7061
7265206561636820
726573756C742077
6974682060657870
6563746564602E txt "One expression built onc…" 15D 0F 0A 85000000 8E00
0000 map leaf, size 10: @85 → @8E 167 6C 696E70757473 txt "inputs" 16E 0F 0A 67010000 5100
0000 map leaf, size 10: @167 → @51 178 8C 65787065637465
64 txt "expected" 181 0F 0A 78010000 7400
0000 map leaf, size 10: @178 → @74 18B 07 0E 02010000 6E01
0000 81010000 map branch, size 14, depth 2, slots 1, 8: @16E → @181 199 07 0A 01000000 8B01
0000 map branch, size 10, depth 1, slots 0: @18B 1A3 AC 65787072657373
696F6E txt "expression" 1AE 0F 0A A3010000 1200
0000 map leaf, size 10: @1A3 → @12 1B8 07 12 40090000 5D01
0000 99010000 AE01
0000 map branch, size 18, depth 0 (root), slots 6, 8, 11: @15D → @199 → @1AE
malformed_text holds these bytes:
text 1 B
]
python 139 B
try :
async with (await stardust .parse (malformed_text , "dust" )):
pass
except stardust .StardustError as error :
result = error
TRON242 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 6C 737461747573 txt "status" 0B 14 10 696E76616C69
645F617267756D65
6E74 txt "invalid_argument" 1D 0F 0A 04000000 0B00
0000 map leaf, size 10: @4 → @B 27 6C 656E74697479 txt "entity" 2E 00 nil 2F 0F 0A 27000000 2E00
0000 map leaf, size 10: @27 → @2E 39 7C 6D657373616765 txt "message" 41 14 1A 496E76616C69
645F53796E746178
206174206F666673
65742030 txt "Invalid_Syntax at offset…" 5D 0F 0A 39000000 4100
0000 map leaf, size 10: @39 → @41 67 07 0E 08020000 2F00
0000 5D000000 map branch, size 14, depth 1, slots 3, 9: @2F → @5D 75 4C 70617468 txt "path" 7A 00 nil 7B 0F 0A 75000000 7A00
0000 map leaf, size 10: @75 → @7A 85 5C 6669656C64 txt "field" 8B 00 nil 8C 0F 0A 85000000 8B00
0000 map leaf, size 10: @85 → @8B 96 4C 636F6465 txt "code" 9B CC 696E76616C6964
5F64757374 txt "invalid_dust" A8 0F 0A 96000000 9B00
0000 map leaf, size 10: @96 → @9B B2 6C 6F6666736574 txt "offset" B9 02 00000000000000
00 i64 0 C2 0F 0A B2000000 B900
0000 map leaf, size 10: @B2 → @B9 CC 07 1E 51620000 1D00
0000 67000000 7B00
0000 8C000000 A800
0000 C2000000 map branch, size 30, depth 0 (root), slots 0, 4, 6, 9, 13, 14: @1D → @67 → @7B → @8C → @A8 → @C2
malformed_text holds these bytes:
text 1 B
[
python 139 B
try :
async with (await stardust .parse (malformed_text , "dust" )):
pass
except stardust .StardustError as error :
result = error
TRON242 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 6C 737461747573 txt "status" 0B 14 10 696E76616C69
645F617267756D65
6E74 txt "invalid_argument" 1D 0F 0A 04000000 0B00
0000 map leaf, size 10: @4 → @B 27 6C 656E74697479 txt "entity" 2E 00 nil 2F 0F 0A 27000000 2E00
0000 map leaf, size 10: @27 → @2E 39 7C 6D657373616765 txt "message" 41 14 1A 556E65787065
637465645F456E64
206174206F666673
65742032 txt "Unexpected_End at offset…" 5D 0F 0A 39000000 4100
0000 map leaf, size 10: @39 → @41 67 07 0E 08020000 2F00
0000 5D000000 map branch, size 14, depth 1, slots 3, 9: @2F → @5D 75 4C 70617468 txt "path" 7A 00 nil 7B 0F 0A 75000000 7A00
0000 map leaf, size 10: @75 → @7A 85 5C 6669656C64 txt "field" 8B 00 nil 8C 0F 0A 85000000 8B00
0000 map leaf, size 10: @85 → @8B 96 4C 636F6465 txt "code" 9B CC 696E76616C6964
5F64757374 txt "invalid_dust" A8 0F 0A 96000000 9B00
0000 map leaf, size 10: @96 → @9B B2 6C 6F6666736574 txt "offset" B9 02 02000000000000
00 i64 2 C2 0F 0A B2000000 B900
0000 map leaf, size 10: @B2 → @B9 CC 07 1E 51620000 1D00
0000 67000000 7B00
0000 8C000000 A800
0000 C2000000 map branch, size 30, depth 0 (root), slots 0, 4, 6, 9, 13, 14: @1D → @67 → @7B → @8C → @A8 → @C2
C exports: stardust_parse , stardust_document_error
python 21 B
def root (self ) -> int
input_text holds this document:
TRON33 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 1C 78 txt "x" 06 02 29000000000000
00 i64 41 0F 0F 0A 04000000 0600
0000 map leaf, size 10: @4 → @6
python 97 B
async with (await stardust .parse (input_text , "tron" )) as input :
result = (await input .root ())
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 00000000000000
00 i64 0
C exports: stardust_document_root
python 22 B
def count (self ) -> int
input_text holds this document:
TRON33 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 1C 78 txt "x" 06 02 29000000000000
00 i64 41 0F 0F 0A 04000000 0600
0000 map leaf, size 10: @4 → @6
python 98 B
async with (await stardust .parse (input_text , "tron" )) as input :
result = (await input .count ())
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 02000000000000
00 i64 2
C exports: stardust_document_count
python 35 B
def read (self , id : int ) -> NodeView
Text contains string values. Read numbers with i64 or f64.
input_text holds this document:
TRON33 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 1C 78 txt "x" 06 02 29000000000000
00 i64 41 0F 0F 0A 04000000 0600
0000 map leaf, size 10: @4 → @6
python 117 B
async with (await stardust .parse (input_text , "tron" )) as input :
result = (await input .read ((await input .root ())))
TRON233 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 3C 6B6579 txt "key" 08 0C txt "" 09 0F 0A 04000000 0800
0000 map leaf, size 10: @4 → @8 13 4C 6B696E64 txt "kind" 18 6C 6F626A656374 txt "object" 1F 0F 0A 13000000 1800
0000 map leaf, size 10: @13 → @18 29 BC 66697273745F63
68696C64 txt "first_child" 35 02 01000000000000
00 i64 1 3E 0F 0A 29000000 3500
0000 map leaf, size 10: @29 → @35 48 8C 706F736974696F
6E txt "position" 51 02 00000000000000
00 i64 0 5A 0F 0A 48000000 5100
0000 map leaf, size 10: @48 → @51 64 07 0E 00810000 3E00
0000 5A000000 map branch, size 14, depth 1, slots 8, 15: @3E → @5A 72 6C 706172656E74 txt "parent" 79 00 nil 7A 0F 0A 72000000 7900
0000 map leaf, size 10: @72 → @79 84 4C 74657874 txt "text" 89 0C txt "" 8A 0F 0A 84000000 8900
0000 map leaf, size 10: @84 → @89 94 7C 626F6F6C65616E txt "boolean" 9C 01 bit false 9D 0F 0A 94000000 9C00
0000 map leaf, size 10: @94 → @9C A7 CC 6E6578745F7369
626C696E67 txt "next_sibling" B4 00 nil B5 0F 0A A7000000 B400
0000 map leaf, size 10: @A7 → @B4 BF 07 22 A1990000 0900
0000 1F000000 6400
0000 7A000000 8A00
0000 9D000000 B500
0000 map branch, size 34, depth 0 (root), slots 0, 5, 7, 8, 11, 12, 15: @9 → @1F → @64 → @7A → @8A → @9D → @B5
C exports: stardust_document_read_many
python 64 B
def read_many (self , start : int , capacity : int ) -> list [NodeView ]
input_text holds this document:
TRON33 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 1C 78 txt "x" 06 02 29000000000000
00 i64 41 0F 0F 0A 04000000 0600
0000 map leaf, size 10: @4 → @6
python 142 B
async with (await stardust .parse (input_text , "tron" )) as input :
views = (await input .read_many ((await input .root ()), 1 ))
result = views [0 ]
TRON233 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 3C 6B6579 txt "key" 08 0C txt "" 09 0F 0A 04000000 0800
0000 map leaf, size 10: @4 → @8 13 4C 6B696E64 txt "kind" 18 6C 6F626A656374 txt "object" 1F 0F 0A 13000000 1800
0000 map leaf, size 10: @13 → @18 29 BC 66697273745F63
68696C64 txt "first_child" 35 02 01000000000000
00 i64 1 3E 0F 0A 29000000 3500
0000 map leaf, size 10: @29 → @35 48 8C 706F736974696F
6E txt "position" 51 02 00000000000000
00 i64 0 5A 0F 0A 48000000 5100
0000 map leaf, size 10: @48 → @51 64 07 0E 00810000 3E00
0000 5A000000 map branch, size 14, depth 1, slots 8, 15: @3E → @5A 72 6C 706172656E74 txt "parent" 79 00 nil 7A 0F 0A 72000000 7900
0000 map leaf, size 10: @72 → @79 84 4C 74657874 txt "text" 89 0C txt "" 8A 0F 0A 84000000 8900
0000 map leaf, size 10: @84 → @89 94 7C 626F6F6C65616E txt "boolean" 9C 01 bit false 9D 0F 0A 94000000 9C00
0000 map leaf, size 10: @94 → @9C A7 CC 6E6578745F7369
626C696E67 txt "next_sibling" B4 00 nil B5 0F 0A A7000000 B400
0000 map leaf, size 10: @A7 → @B4 BF 07 22 A1990000 0900
0000 1F000000 6400
0000 7A000000 8A00
0000 9D000000 B500
0000 map branch, size 34, depth 0 (root), slots 0, 5, 7, 8, 11, 12, 15: @9 → @1F → @64 → @7A → @8A → @9D → @B5
C exports: stardust_document_read_many
python 42 B
def member (self , id : int , key : str ) -> int
input_text holds this document:
TRON33 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 1C 78 txt "x" 06 02 29000000000000
00 i64 41 0F 0F 0A 04000000 0600
0000 map leaf, size 10: @4 → @6
python 124 B
async with (await stardust .parse (input_text , "tron" )) as input :
result = (await input .member ((await input .root ()), "x" ))
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 01000000000000
00 i64 1
C exports: stardust_document_member
python 49 B
def children (self , id : int ) -> Iterator [NodeView ]
Keep the document open during iteration. A scalar has no children. A read failure is reported once and ends iteration.
seed_text holds this document:
TRON449 B
Offset (hex) Bytes (hex) Meaning 000 54 52 4F 4E magic TRON 004 3C 616765 txt "age" 008 02 24000000000000
00 i64 36 011 0F 0A 04000000 0800
0000 map leaf, size 10: @4 → @8 01B 4C 726F6C65 txt "role" 020 8C 656E67696E6565
72 txt "engineer" 029 0F 0A 1B000000 2000
0000 map leaf, size 10: @1B → @20 033 4C 6E616D65 txt "name" 038 3C 416461 txt "Ada" 03C 0F 0A 33000000 3800
0000 map leaf, size 10: @33 → @38 046 07 12 00910000 1100
0000 29000000 3C00
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C 058 5C 236C696E6B txt "#link" 05E 5C 235F616461 txt "#_ada" 064 0F 0A 58000000 5E00
0000 map leaf, size 10: @58 → @5E 06E 3C 616765 txt "age" 072 02 29000000000000
00 i64 41 07B 0F 0A 6E000000 7200
0000 map leaf, size 10: @6E → @72 085 6C 6D656E746F72 txt "mentor" 08C 0F 0A 85000000 6400
0000 map leaf, size 10: @85 → @64 096 4C 726F6C65 txt "role" 09B 8C 656E67696E6565
72 txt "engineer" 0A4 0F 0A 96000000 9B00
0000 map leaf, size 10: @96 → @9B 0AE 4C 6E616D65 txt "name" 0B3 3C 426F62 txt "Bob" 0B7 0F 0A AE000000 B300
0000 map leaf, size 10: @AE → @B3 0C1 07 16 00990000 7B00
0000 8C000000 A400
0000 B7000000 map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7 0D7 3C 616765 txt "age" 0DB 02 1D000000000000
00 i64 29 0E4 0F 0A D7000000 DB00
0000 map leaf, size 10: @D7 → @DB 0EE 4C 726F6C65 txt "role" 0F3 8C 64657369676E65
72 txt "designer" 0FC 0F 0A EE000000 F300
0000 map leaf, size 10: @EE → @F3 106 4C 6E616D65 txt "name" 10B 2C 4379 txt "Cy" 10E 0F 0A 06010000 0B01
0000 map leaf, size 10: @106 → @10B 118 07 12 00910000 E400
0000 FC000000 0E01
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E 12A 6C 617574686F72 txt "author" 131 5C 736D6F6B65 txt "smoke" 137 0F 0A 2A010000 3101
0000 map leaf, size 10: @12A → @131 141 6C 726561736F6E txt "reason" 148 4C 73656564 txt "seed" 14D 0F 0A 41010000 4801
0000 map leaf, size 10: @141 → @148 157 07 0E 40080000 3701
0000 4D010000 map branch, size 14, depth 0 (root), slots 6, 11: @137 → @14D 165 4C 235F7478 txt "#_tx" 16A 0F 0A 65010000 5701
0000 map leaf, size 10: @165 → @157 174 4C 235F6379 txt "#_cy" 179 0F 0A 74010000 1801
0000 map leaf, size 10: @174 → @118 183 5C 235F626F62 txt "#_bob" 189 0F 0A 83010000 C100
0000 map leaf, size 10: @183 → @C1 193 5C 235F616461 txt "#_ada" 199 0F 0A 93010000 4600
0000 map leaf, size 10: @193 → @46 1A3 07 16 88210000 6A01
0000 79010000 8901
0000 99010000 map branch, size 22, depth 0 (root), slots 3, 7, 8, 13: @16A → @179 → @189 → @199
python 142 B
async with (await stardust .parse (seed_text , "tron" )) as source :
result = sum ([1 async for view in source .children ((await source .root ()))])
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 04000000000000
00 i64 4
C exports: stardust_document_read_many
python 60 B
def members (self , id : int ) -> Iterator [tuple [str , NodeView ]]
Duplicate keys appear in document order. Keep the document open during iteration. A read failure is reported once and ends iteration.
seed_text holds this document:
TRON449 B
Offset (hex) Bytes (hex) Meaning 000 54 52 4F 4E magic TRON 004 3C 616765 txt "age" 008 02 24000000000000
00 i64 36 011 0F 0A 04000000 0800
0000 map leaf, size 10: @4 → @8 01B 4C 726F6C65 txt "role" 020 8C 656E67696E6565
72 txt "engineer" 029 0F 0A 1B000000 2000
0000 map leaf, size 10: @1B → @20 033 4C 6E616D65 txt "name" 038 3C 416461 txt "Ada" 03C 0F 0A 33000000 3800
0000 map leaf, size 10: @33 → @38 046 07 12 00910000 1100
0000 29000000 3C00
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C 058 5C 236C696E6B txt "#link" 05E 5C 235F616461 txt "#_ada" 064 0F 0A 58000000 5E00
0000 map leaf, size 10: @58 → @5E 06E 3C 616765 txt "age" 072 02 29000000000000
00 i64 41 07B 0F 0A 6E000000 7200
0000 map leaf, size 10: @6E → @72 085 6C 6D656E746F72 txt "mentor" 08C 0F 0A 85000000 6400
0000 map leaf, size 10: @85 → @64 096 4C 726F6C65 txt "role" 09B 8C 656E67696E6565
72 txt "engineer" 0A4 0F 0A 96000000 9B00
0000 map leaf, size 10: @96 → @9B 0AE 4C 6E616D65 txt "name" 0B3 3C 426F62 txt "Bob" 0B7 0F 0A AE000000 B300
0000 map leaf, size 10: @AE → @B3 0C1 07 16 00990000 7B00
0000 8C000000 A400
0000 B7000000 map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7 0D7 3C 616765 txt "age" 0DB 02 1D000000000000
00 i64 29 0E4 0F 0A D7000000 DB00
0000 map leaf, size 10: @D7 → @DB 0EE 4C 726F6C65 txt "role" 0F3 8C 64657369676E65
72 txt "designer" 0FC 0F 0A EE000000 F300
0000 map leaf, size 10: @EE → @F3 106 4C 6E616D65 txt "name" 10B 2C 4379 txt "Cy" 10E 0F 0A 06010000 0B01
0000 map leaf, size 10: @106 → @10B 118 07 12 00910000 E400
0000 FC000000 0E01
0000 map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E 12A 6C 617574686F72 txt "author" 131 5C 736D6F6B65 txt "smoke" 137 0F 0A 2A010000 3101
0000 map leaf, size 10: @12A → @131 141 6C 726561736F6E txt "reason" 148 4C 73656564 txt "seed" 14D 0F 0A 41010000 4801
0000 map leaf, size 10: @141 → @148 157 07 0E 40080000 3701
0000 4D010000 map branch, size 14, depth 0 (root), slots 6, 11: @137 → @14D 165 4C 235F7478 txt "#_tx" 16A 0F 0A 65010000 5701
0000 map leaf, size 10: @165 → @157 174 4C 235F6379 txt "#_cy" 179 0F 0A 74010000 1801
0000 map leaf, size 10: @174 → @118 183 5C 235F626F62 txt "#_bob" 189 0F 0A 83010000 C100
0000 map leaf, size 10: @183 → @C1 193 5C 235F616461 txt "#_ada" 199 0F 0A 93010000 4600
0000 map leaf, size 10: @193 → @46 1A3 07 16 88210000 6A01
0000 79010000 8901
0000 99010000 map branch, size 22, depth 0 (root), slots 3, 7, 8, 13: @16A → @179 → @189 → @199
python 135 B
async with (await stardust .parse (seed_text , "tron" )) as source :
result , view = (await anext (source .members ((await source .root ()))))
TRON32 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 4C 74657874 txt "text" 09 4C 235F7478 txt "#_tx" 0E 0F 0A 04000000 0900
0000 map leaf, size 10: @4 → @9
C exports: stardust_document_read_many
python 29 B
def i64 (self , id : int ) -> int
input_text holds this document:
TRON33 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 1C 78 txt "x" 06 02 29000000000000
00 i64 41 0F 0F 0A 04000000 0600
0000 map leaf, size 10: @4 → @6
python 153 B
async with (await stardust .parse (input_text , "tron" )) as input :
x = (await input .member ((await input .root ()), "x" ))
result = (await input .i64 (x ))
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 02 29000000000000
00 i64 41
C exports: stardust_document_i64
python 31 B
def f64 (self , id : int ) -> float
Integer conversion can round values outside the exact f64 integer range.
number_text holds this document:
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 03 000000000000F0
3F f64 1
python 120 B
async with (await stardust .parse (number_text , "tron" )) as number :
result = (await number .f64 ((await number .root ())))
TRON21 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 03 000000000000F0
3F f64 1
C exports: stardust_document_f64
python 23 B
def close (self ) -> None
Consumes the receiver handle.
expression_text holds this document:
TRON47 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 1C 2B txt "+" 06 2C 3F78 txt "?x" 09 02 01000000000000
00 i64 1 12 0E 15 00 0700 030000
00 04000000 060000
00 09000000 array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @4 → @6 → @9
python 123 B
async with (await stardust .parse (expression_text , "tron" )) as expression :
result = (await expression .serialize ("tron" ))
TRON76 B
Offset (hex) Bytes (hex) Meaning 00 54 52 4F 4E magic TRON 04 4C 74657874 txt "text" 09 14 2F 54524F4E1C2B
2C3F780201000000
000000000E150007
0003000000040000
0006000000090000
0012000000000000
00 txt "TRON\u001C+,?x\u0002\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000E\u0015\u0000\u0007\u0000\u0003…" 3A 0F 0A 04000000 0900
0000 map leaf, size 10: @4 → @9
C exports: stardust_document_release
This record contains the result of read and read_many. The key and text fields are owned strings and remain valid after the document closes.
This record supplies a node for add and add_many. The number field holds a typed i64 or f64 value. Go uses I64/F64, Rust and Odin use Number, Clojure uses long or double, and Python uses int or float. This value sets the ABI number kind and the integer or real field.