You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @brief if the root JSON is an array, return its length
15
+
* @brief Returns its length when the current root is an array; errors otherwise.
16
16
**/
17
17
pubfnget_length(self) ->u32 {
18
18
assert(self.layer_type_of_root == ARRAY_LAYER, "can only get length of an array type");
@@ -23,7 +23,7 @@ impl<let NumBytes: u32, let NumPackedFields: u32, let MaxNumTokens: u32, let Max
23
23
24
24
/**
25
25
* @brief if the root JSON is an object, extract an array given by `key`
26
-
* @description returns an Option<JSON> where, if the array exists, the JSON object will have the requested array as its root value
26
+
* @description From an object root, returns Some(JSON) if key exists and is an array, None if key is missing; errors if key exists but is not an array, or if called when the current root is an array.
assert(self.layer_type_of_root != ARRAY_LAYER, "cannot extract array elements via a key");
@@ -115,7 +115,7 @@ impl<let NumBytes: u32, let NumPackedFields: u32, let MaxNumTokens: u32, let Max
115
115
116
116
/**
117
117
* @brief if the root JSON is an array, extract an array given by the position of the target in the source array
118
-
* @description returns an Option<JSON> where, if the array exists, the JSON object will have the requested array as its root value
118
+
* @description When the current root is an array, returns the nested array at `index` wrapped in `Option`. Returns `None` if `index` is out of bounds; errors if in-bounds but the element is not an array.
* @brief if the root JSON is an object, extract a child object given by `key`
15
-
* @description returns an Option<JSON> where, if the object exists, the JSON object will have the requested object as its root value
14
+
* @brief From an object root, returns `Some(JSON)` if `key` exists and is an object, `None` if `key` is missing; errors if `key` exists but is not an object, or if called when the current root is an array.
assert(self.layer_type_of_root != ARRAY_LAYER, "cannot extract array elements via a key");
@@ -83,7 +81,7 @@ impl<let NumBytes: u32, let NumPackedFields: u32, let MaxNumTokens: u32, let Max
83
81
}
84
82
85
83
/**
86
-
* @brief same as `get_object_unchecked` for where the key length may be less than KeyBytes
84
+
* @brief Same as `get_object_unchecked`, but with a variable-length key.
87
85
**/
88
86
pubfnget_object_unchecked_var<letKeyBytes: u32>(
89
87
self,
@@ -107,7 +105,7 @@ impl<let NumBytes: u32, let NumPackedFields: u32, let MaxNumTokens: u32, let Max
107
105
108
106
/**
109
107
* @brief if the root JSON is an array, extract an object given by the position of the target in the source array
110
-
* @description returns an Option<JSON> where, if the object exists, the JSON object will have the requested object as its root value
108
+
* @description When the current root is an array, returns the object at `index` wrapped in `Option`. Returns `None` if `index` is out of bounds; errors if in-bounds but the element is not an object.
0 commit comments