This repository was archived by the owner on Sep 12, 2018. It is now read-only.
File tree Expand file tree Collapse file tree
sdks/android/Mentat/library/src/main/java/org/mozilla/mentat Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1666,6 +1666,14 @@ pub unsafe extern "C" fn typed_value_value_type_kw(typed_value: *mut Binding) ->
16661666 string_to_c_char ( value. clone ( ) )
16671667}
16681668
1669+ /// Returns the size of a `row` as usize
1670+ #[ no_mangle]
1671+ pub unsafe extern "C" fn typed_value_list_size ( values : * mut Vec < Binding > ) -> c_int {
1672+ assert_not_null ! ( values) ;
1673+ let values = & * values;
1674+ values. len ( ) as c_int
1675+ }
1676+
16691677/// Returns the value at the provided `index` as a `Vec<ValueType>`.
16701678/// If there is no value present at the `index`, a null pointer is returned.
16711679///
Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ class EntityBuilder extends PointerType {}
158158 int typed_value_value_type (TypedValue value );
159159 Pointer typed_value_value_type_kw (TypedValue value );
160160
161+ int typed_value_list_size (TypedValueList rows );
161162 TypedValueList row_at_index (RelResult rows , int index );
162163 RelResultIter typed_value_result_set_into_iter (RelResult rows );
163164 TypedValueList typed_value_result_set_iter_next (RelResultIter iter );
Original file line number Diff line number Diff line change 3737 */
3838public class TupleResult extends RustObject <JNA .TypedValueList > {
3939
40+ private int size ;
41+
4042 public TupleResult (JNA .TypedValueList pointer ) {
4143 super (pointer );
44+ this .size = JNA .INSTANCE .typed_value_list_size (super .validPointer ());
4245 }
4346
4447 /**
@@ -145,6 +148,14 @@ public UUID asUUID(Integer index) {
145148 JNA .INSTANCE .value_at_index_into_uuid (this .validPointer (), index ));
146149 }
147150
151+ /**
152+ * Return the size of the tuple.
153+ * @return The number of items in this tuple
154+ */
155+ public int size () {
156+ return this .size ;
157+ }
158+
148159 @ Override
149160 protected void destroyPointer (JNA .TypedValueList p ) {
150161 JNA .INSTANCE .typed_value_list_destroy (p );
You can’t perform that action at this time.
0 commit comments