Update consuming FFI function names to better reflect consuming nature (as -> to).

This commit is contained in:
Emily Toop 2018-05-11 12:22:03 +01:00
parent f38f27f848
commit 31556023e5
12 changed files with 100 additions and 100 deletions

View file

@ -506,7 +506,7 @@ fn unwrap_conversion<T>(value: Option<T>, expected_type: ValueType) -> T {
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Long).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_long(typed_value: *mut Binding) -> c_longlong {
pub unsafe extern "C" fn typed_value_into_long(typed_value: *mut Binding) -> c_longlong {
let typed_value = Box::from_raw(typed_value);
unwrap_conversion(typed_value.into_long(), ValueType::Long)
}
@ -517,7 +517,7 @@ pub unsafe extern "C" fn typed_value_as_long(typed_value: *mut Binding) -> c_lon
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Ref).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_entid(typed_value: *mut Binding) -> Entid {
pub unsafe extern "C" fn typed_value_into_entid(typed_value: *mut Binding) -> Entid {
let typed_value = Box::from_raw(typed_value);
unwrap_conversion(typed_value.into_entid(), ValueType::Ref)
}
@ -528,7 +528,7 @@ pub unsafe extern "C" fn typed_value_as_entid(typed_value: *mut Binding) -> Enti
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Ref).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_kw(typed_value: *mut Binding) -> *const c_char {
pub unsafe extern "C" fn typed_value_into_kw(typed_value: *mut Binding) -> *const c_char {
let typed_value = Box::from_raw(typed_value);
unwrap_conversion(typed_value.into_kw_c_string(), ValueType::Keyword) as *const c_char
}
@ -541,7 +541,7 @@ pub unsafe extern "C" fn typed_value_as_kw(typed_value: *mut Binding) -> *const
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Boolean).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_boolean(typed_value: *mut Binding) -> i32 {
pub unsafe extern "C" fn typed_value_into_boolean(typed_value: *mut Binding) -> i32 {
let typed_value = Box::from_raw(typed_value);
if unwrap_conversion(typed_value.into_boolean(), ValueType::Boolean) { 1 } else { 0 }
}
@ -552,7 +552,7 @@ pub unsafe extern "C" fn typed_value_as_boolean(typed_value: *mut Binding) -> i3
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Double).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_double(typed_value: *mut Binding) -> f64 {
pub unsafe extern "C" fn typed_value_into_double(typed_value: *mut Binding) -> f64 {
let typed_value = Box::from_raw(typed_value);
unwrap_conversion(typed_value.into_double(), ValueType::Double)
}
@ -563,7 +563,7 @@ pub unsafe extern "C" fn typed_value_as_double(typed_value: *mut Binding) -> f64
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Instant).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_timestamp(typed_value: *mut Binding) -> c_longlong {
pub unsafe extern "C" fn typed_value_into_timestamp(typed_value: *mut Binding) -> c_longlong {
let typed_value = Box::from_raw(typed_value);
unwrap_conversion(typed_value.into_timestamp(), ValueType::Instant)
}
@ -574,7 +574,7 @@ pub unsafe extern "C" fn typed_value_as_timestamp(typed_value: *mut Binding) ->
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::String).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_string(typed_value: *mut Binding) -> *const c_char {
pub unsafe extern "C" fn typed_value_into_string(typed_value: *mut Binding) -> *const c_char {
let typed_value = Box::from_raw(typed_value);
unwrap_conversion(typed_value.into_c_string(), ValueType::String) as *const c_char
}
@ -585,7 +585,7 @@ pub unsafe extern "C" fn typed_value_as_string(typed_value: *mut Binding) -> *co
///
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Uuid).
#[no_mangle]
pub unsafe extern "C" fn typed_value_as_uuid(typed_value: *mut Binding) -> *mut [u8; 16] {
pub unsafe extern "C" fn typed_value_into_uuid(typed_value: *mut Binding) -> *mut [u8; 16] {
let typed_value = Box::from_raw(typed_value);
let value = unwrap_conversion(typed_value.into_uuid(), ValueType::Uuid);
Box::into_raw(Box::new(*value.as_bytes()))
@ -620,7 +620,7 @@ pub unsafe extern "C" fn row_at_index(rows: *mut RelResult<Binding>, index: c_in
/// A destructor `typed_value_result_set_iter_destroy` is provided for releasing the memory for this
/// pointer type.
#[no_mangle]
pub unsafe extern "C" fn rows_iter(rows: *mut RelResult<Binding>) -> *mut BindingListIterator {
pub unsafe extern "C" fn typed_value_result_set_into_iter(rows: *mut RelResult<Binding>) -> *mut BindingListIterator {
let result = &*rows;
let rows = result.rows();
Box::into_raw(Box::new(rows))
@ -635,7 +635,7 @@ pub unsafe extern "C" fn rows_iter(rows: *mut RelResult<Binding>) -> *mut Bindin
/// A destructor `typed_value_list_destroy` is provided for releasing the memory for this
/// pointer type.
#[no_mangle]
pub unsafe extern "C" fn rows_iter_next(iter: *mut BindingListIterator) -> *mut Vec<Binding> {
pub unsafe extern "C" fn typed_value_result_set_iter_next(iter: *mut BindingListIterator) -> *mut Vec<Binding> {
let iter = &mut *iter;
iter.next().map_or(std::ptr::null_mut(), |v| Box::into_raw(Box::new(v.to_vec())))
}
@ -648,7 +648,7 @@ pub unsafe extern "C" fn rows_iter_next(iter: *mut BindingListIterator) -> *mut
/// A destructor `typed_value_list_iter_destroy` is provided for releasing the memory for this
/// pointer type.
#[no_mangle]
pub unsafe extern "C" fn values_iter(values: *mut Vec<Binding>) -> *mut BindingIterator {
pub unsafe extern "C" fn typed_value_list_into_iter(values: *mut Vec<Binding>) -> *mut BindingIterator {
let result = Box::from_raw(values);
Box::into_raw(Box::new(result.into_iter()))
}
@ -662,7 +662,7 @@ pub unsafe extern "C" fn values_iter(values: *mut Vec<Binding>) -> *mut BindingI
/// A destructor `typed_value_destroy` is provided for releasing the memory for this
/// pointer type.
#[no_mangle]
pub unsafe extern "C" fn values_iter_next(iter: *mut BindingIterator) -> *mut Binding {
pub unsafe extern "C" fn typed_value_list_iter_next(iter: *mut BindingIterator) -> *mut Binding {
let iter = &mut *iter;
iter.next().map_or(std::ptr::null_mut(), |v| Box::into_raw(Box::new(v)))
}
@ -688,7 +688,7 @@ pub unsafe extern "C" fn value_at_index(values: *mut Vec<Binding>, index: c_int)
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not `ValueType::Long`.
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_long(values: *mut Vec<Binding>, index: c_int) -> c_longlong {
pub unsafe extern "C" fn value_at_index_into_long(values: *mut Vec<Binding>, index: c_int) -> c_longlong {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
unwrap_conversion(value.clone().into_long(), ValueType::Long)
@ -701,7 +701,7 @@ pub unsafe extern "C" fn value_at_index_as_long(values: *mut Vec<Binding>, index
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not `ValueType::Ref`.
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_entid(values: *mut Vec<Binding>, index: c_int) -> Entid {
pub unsafe extern "C" fn value_at_index_into_entid(values: *mut Vec<Binding>, index: c_int) -> Entid {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
unwrap_conversion(value.clone().into_entid(), ValueType::Ref)
@ -714,7 +714,7 @@ pub unsafe extern "C" fn value_at_index_as_entid(values: *mut Vec<Binding>, inde
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Ref](mentat::ValueType::Ref).
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_kw(values: *mut Vec<Binding>, index: c_int) -> *const c_char {
pub unsafe extern "C" fn value_at_index_into_kw(values: *mut Vec<Binding>, index: c_int) -> *const c_char {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
unwrap_conversion(value.clone().into_kw_c_string(), ValueType::Keyword) as *const c_char
@ -729,7 +729,7 @@ pub unsafe extern "C" fn value_at_index_as_kw(values: *mut Vec<Binding>, index:
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Long](mentat::ValueType::Long).
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_boolean(values: *mut Vec<Binding>, index: c_int) -> i32 {
pub unsafe extern "C" fn value_at_index_into_boolean(values: *mut Vec<Binding>, index: c_int) -> i32 {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
if unwrap_conversion(value.clone().into_boolean(), ValueType::Boolean) { 1 } else { 0 }
@ -742,7 +742,7 @@ pub unsafe extern "C" fn value_at_index_as_boolean(values: *mut Vec<Binding>, in
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Double](mentat::ValueType::Double).
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_double(values: *mut Vec<Binding>, index: c_int) -> f64 {
pub unsafe extern "C" fn value_at_index_into_double(values: *mut Vec<Binding>, index: c_int) -> f64 {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
unwrap_conversion(value.clone().into_double(), ValueType::Double)
@ -755,7 +755,7 @@ pub unsafe extern "C" fn value_at_index_as_double(values: *mut Vec<Binding>, ind
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Instant](mentat::ValueType::Instant).
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_timestamp(values: *mut Vec<Binding>, index: c_int) -> c_longlong {
pub unsafe extern "C" fn value_at_index_into_timestamp(values: *mut Vec<Binding>, index: c_int) -> c_longlong {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
unwrap_conversion(value.clone().into_timestamp(), ValueType::Instant)
@ -768,7 +768,7 @@ pub unsafe extern "C" fn value_at_index_as_timestamp(values: *mut Vec<Binding>,
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::String](mentat::ValueType::String).
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_string(values: *mut Vec<Binding>, index: c_int) -> *const c_char {
pub unsafe extern "C" fn value_at_index_into_string(values: *mut Vec<Binding>, index: c_int) -> *const c_char {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
unwrap_conversion(value.clone().into_c_string(), ValueType::String) as *const c_char
@ -781,7 +781,7 @@ pub unsafe extern "C" fn value_at_index_as_string(values: *mut Vec<Binding>, ind
/// If the [ValueType](mentat::ValueType) of the [Binding](mentat::Binding) is not [ValueType::Uuid](mentat::ValueType::Uuid).
/// If there is no value at `index`.
#[no_mangle]
pub unsafe extern "C" fn value_at_index_as_uuid(values: *mut Vec<Binding>, index: c_int) -> *mut [u8; 16] {
pub unsafe extern "C" fn value_at_index_into_uuid(values: *mut Vec<Binding>, index: c_int) -> *mut [u8; 16] {
let result = &*values;
let value = result.get(index as usize).expect("No value at index");
let uuid = unwrap_conversion(value.clone().into_uuid(), ValueType::Uuid);

View file

@ -26,7 +26,7 @@ public class ColResultIterator extends RustObject implements Iterator {
}
private Pointer getNextPointer() {
return JNA.INSTANCE.values_iter_next(this.rawPointer);
return JNA.INSTANCE.typed_value_list_iter_next(this.rawPointer);
}
@Override

View file

@ -50,7 +50,7 @@ public class CollResult extends TupleResult implements Iterable<TypedValue> {
@Override
public ColResultIterator iterator() {
Pointer iterPointer = JNA.INSTANCE.values_iter(this.rawPointer);
Pointer iterPointer = JNA.INSTANCE.typed_value_list_into_iter(this.rawPointer);
this.rawPointer = null;
if (iterPointer == null) {
return null;

View file

@ -72,30 +72,30 @@ public interface JNA extends Library {
RustResult query_builder_execute_tuple(Pointer query);
// Query Result Processing
long typed_value_as_long(Pointer value);
long typed_value_as_entid(Pointer value);
String typed_value_as_kw(Pointer value);
String typed_value_as_string(Pointer value);
Pointer typed_value_as_uuid(Pointer value);
int typed_value_as_boolean(Pointer value);
double typed_value_as_double(Pointer value);
long typed_value_as_timestamp(Pointer value);
long typed_value_into_long(Pointer value);
long typed_value_into_entid(Pointer value);
String typed_value_into_kw(Pointer value);
String typed_value_into_string(Pointer value);
Pointer typed_value_into_uuid(Pointer value);
int typed_value_into_boolean(Pointer value);
double typed_value_into_double(Pointer value);
long typed_value_into_timestamp(Pointer value);
Pointer typed_value_value_type(Pointer value);
Pointer row_at_index(Pointer rows, int index);
Pointer rows_iter(Pointer rows);
Pointer rows_iter_next(Pointer iter);
Pointer typed_value_result_set_into_iter(Pointer rows);
Pointer typed_value_result_set_iter_next(Pointer iter);
Pointer values_iter(Pointer rows);
Pointer values_iter_next(Pointer iter);
Pointer typed_value_list_into_iter(Pointer rows);
Pointer typed_value_list_iter_next(Pointer iter);
Pointer value_at_index(Pointer rows, int index);
long value_at_index_as_long(Pointer rows, int index);
long value_at_index_as_entid(Pointer rows, int index);
String value_at_index_as_kw(Pointer rows, int index);
String value_at_index_as_string(Pointer rows, int index);
Pointer value_at_index_as_uuid(Pointer rows, int index);
long value_at_index_as_boolean(Pointer rows, int index);
double value_at_index_as_double(Pointer rows, int index);
long value_at_index_as_timestamp(Pointer rows, int index);
long value_at_index_into_long(Pointer rows, int index);
long value_at_index_into_entid(Pointer rows, int index);
String value_at_index_into_kw(Pointer rows, int index);
String value_at_index_into_string(Pointer rows, int index);
Pointer value_at_index_into_uuid(Pointer rows, int index);
long value_at_index_into_boolean(Pointer rows, int index);
double value_at_index_into_double(Pointer rows, int index);
long value_at_index_into_timestamp(Pointer rows, int index);
}

View file

@ -69,7 +69,7 @@ public class RelResult extends RustObject implements Iterable<TupleResult> {
@Override
public RelResultIterator iterator() {
this.validate();
Pointer iterPointer = JNA.INSTANCE.rows_iter(this.rawPointer);
Pointer iterPointer = JNA.INSTANCE.typed_value_result_set_into_iter(this.rawPointer);
this.rawPointer = null;
if (iterPointer == null) {
return null;

View file

@ -25,7 +25,7 @@ public class RelResultIterator extends RustObject implements Iterator {
}
private Pointer getNextPointer() {
return JNA.INSTANCE.rows_iter_next(this.rawPointer);
return JNA.INSTANCE.typed_value_result_set_iter_next(this.rawPointer);
}
@Override

View file

@ -66,7 +66,7 @@ public class TupleResult extends RustObject {
*/
public Long asLong(Integer index) {
this.validate();
return JNA.INSTANCE.value_at_index_as_long(this.rawPointer, index);
return JNA.INSTANCE.value_at_index_into_long(this.rawPointer, index);
}
/**
@ -78,7 +78,7 @@ public class TupleResult extends RustObject {
*/
public Long asEntid(Integer index) {
this.validate();
return JNA.INSTANCE.value_at_index_as_entid(this.rawPointer, index);
return JNA.INSTANCE.value_at_index_into_entid(this.rawPointer, index);
}
/**
@ -90,7 +90,7 @@ public class TupleResult extends RustObject {
*/
public String asKeyword(Integer index) {
this.validate();
return JNA.INSTANCE.value_at_index_as_kw(this.rawPointer, index);
return JNA.INSTANCE.value_at_index_into_kw(this.rawPointer, index);
}
/**
@ -102,7 +102,7 @@ public class TupleResult extends RustObject {
*/
public Boolean asBool(Integer index) {
this.validate();
return JNA.INSTANCE.value_at_index_as_boolean(this.rawPointer, index) == 0 ? false : true;
return JNA.INSTANCE.value_at_index_into_boolean(this.rawPointer, index) == 0 ? false : true;
}
/**
@ -114,7 +114,7 @@ public class TupleResult extends RustObject {
*/
public Double asDouble(Integer index) {
this.validate();
return JNA.INSTANCE.value_at_index_as_double(this.rawPointer, index);
return JNA.INSTANCE.value_at_index_into_double(this.rawPointer, index);
}
/**
@ -126,7 +126,7 @@ public class TupleResult extends RustObject {
*/
public Date asDate(Integer index) {
this.validate();
return new Date(JNA.INSTANCE.value_at_index_as_timestamp(this.rawPointer, index));
return new Date(JNA.INSTANCE.value_at_index_into_timestamp(this.rawPointer, index));
}
/**
@ -138,7 +138,7 @@ public class TupleResult extends RustObject {
*/
public String asString(Integer index) {
this.validate();
return JNA.INSTANCE.value_at_index_as_string(this.rawPointer, index);
return JNA.INSTANCE.value_at_index_into_string(this.rawPointer, index);
}
/**
@ -150,7 +150,7 @@ public class TupleResult extends RustObject {
*/
public UUID asUUID(Integer index) {
this.validate();
Pointer uuidPtr = JNA.INSTANCE.value_at_index_as_uuid(this.rawPointer, index);
Pointer uuidPtr = JNA.INSTANCE.value_at_index_into_uuid(this.rawPointer, index);
byte[] bytes = uuidPtr.getByteArray(0, 16);
ByteBuffer bb = ByteBuffer.wrap(bytes);
long high = bb.getLong();

View file

@ -45,7 +45,7 @@ public class TypedValue extends RustObject {
*/
public Long asLong() {
if (!this.isConsumed()) {
this.value = JNA.INSTANCE.typed_value_as_long(this.rawPointer);
this.value = JNA.INSTANCE.typed_value_into_long(this.rawPointer);
this.rawPointer = null;
}
return (Long)value;
@ -58,7 +58,7 @@ public class TypedValue extends RustObject {
*/
public Long asEntid() {
if (!this.isConsumed()) {
this.value = JNA.INSTANCE.typed_value_as_entid(this.rawPointer);
this.value = JNA.INSTANCE.typed_value_into_entid(this.rawPointer);
this.rawPointer = null;
}
return (Long)value;
@ -71,7 +71,7 @@ public class TypedValue extends RustObject {
*/
public String asKeyword() {
if (!this.isConsumed()) {
this.value = JNA.INSTANCE.typed_value_as_kw(this.rawPointer);
this.value = JNA.INSTANCE.typed_value_into_kw(this.rawPointer);
this.rawPointer = null;
}
return (String)value;
@ -84,7 +84,7 @@ public class TypedValue extends RustObject {
*/
public Boolean asBoolean() {
if (!this.isConsumed()) {
long value = JNA.INSTANCE.typed_value_as_boolean(this.rawPointer);
long value = JNA.INSTANCE.typed_value_into_boolean(this.rawPointer);
this.value = value == 0 ? false : true;
this.rawPointer = null;
}
@ -98,7 +98,7 @@ public class TypedValue extends RustObject {
*/
public Double asDouble() {
if (!this.isConsumed()) {
this.value = JNA.INSTANCE.typed_value_as_double(this.rawPointer);
this.value = JNA.INSTANCE.typed_value_into_double(this.rawPointer);
this.rawPointer = null;
}
return (Double)value;
@ -111,7 +111,7 @@ public class TypedValue extends RustObject {
*/
public Date asDate() {
if (!this.isConsumed()) {
this.value = new Date(JNA.INSTANCE.typed_value_as_timestamp(this.rawPointer) * 1_000);
this.value = new Date(JNA.INSTANCE.typed_value_into_timestamp(this.rawPointer) * 1_000);
this.rawPointer = null;
}
return (Date)this.value;
@ -124,7 +124,7 @@ public class TypedValue extends RustObject {
*/
public String asString() {
if (!this.isConsumed()) {
this.value = JNA.INSTANCE.typed_value_as_string(this.rawPointer);
this.value = JNA.INSTANCE.typed_value_into_string(this.rawPointer);
this.rawPointer = null;
}
return (String)value;
@ -137,7 +137,7 @@ public class TypedValue extends RustObject {
*/
public UUID asUUID() {
if (!this.isConsumed()) {
Pointer uuidPtr = JNA.INSTANCE.typed_value_as_uuid(this.rawPointer);
Pointer uuidPtr = JNA.INSTANCE.typed_value_into_uuid(this.rawPointer);
byte[] bytes = uuidPtr.getByteArray(0, 16);
ByteBuffer bb = ByteBuffer.wrap(bytes);
long high = bb.getLong();

View file

@ -48,7 +48,7 @@ class TypedValue: OptionalRustObject {
self.raw = nil
}
if !self.isConsumed() {
self.value = typed_value_as_long(self.raw!)
self.value = typed_value_into_long(self.raw!)
}
return self.value as! Int64
}
@ -65,7 +65,7 @@ class TypedValue: OptionalRustObject {
}
if !self.isConsumed() {
self.value = typed_value_as_entid(self.raw!)
self.value = typed_value_into_entid(self.raw!)
}
return self.value as! Entid
}
@ -82,7 +82,7 @@ class TypedValue: OptionalRustObject {
}
if !self.isConsumed() {
self.value = String(cString: typed_value_as_kw(self.raw!))
self.value = String(cString: typed_value_into_kw(self.raw!))
}
return self.value as! String
}
@ -99,7 +99,7 @@ class TypedValue: OptionalRustObject {
}
if !self.isConsumed() {
let v = typed_value_as_boolean(self.raw!)
let v = typed_value_into_boolean(self.raw!)
self.value = v > 0
}
return self.value as! Bool
@ -117,7 +117,7 @@ class TypedValue: OptionalRustObject {
}
if !self.isConsumed() {
self.value = typed_value_as_double(self.raw!)
self.value = typed_value_into_double(self.raw!)
}
return self.value as! Double
}
@ -134,7 +134,7 @@ class TypedValue: OptionalRustObject {
}
if !self.isConsumed() {
let timestamp = typed_value_as_timestamp(self.raw!)
let timestamp = typed_value_into_timestamp(self.raw!)
self.value = Date(timeIntervalSince1970: TimeInterval(timestamp))
}
return self.value as! Date
@ -152,7 +152,7 @@ class TypedValue: OptionalRustObject {
}
if !self.isConsumed() {
self.value = String(cString: typed_value_as_string(self.raw!))
self.value = String(cString: typed_value_into_string(self.raw!))
}
return self.value as! String
}
@ -169,7 +169,7 @@ class TypedValue: OptionalRustObject {
}
if !self.isConsumed() {
let bytes = typed_value_as_uuid(self.raw!).pointee
let bytes = typed_value_into_uuid(self.raw!).pointee
self.value = UUID(uuid: bytes)
}
return self.value as! UUID?

View file

@ -82,7 +82,7 @@ class RelResultIterator: OptionalRustObject, IteratorProtocol {
func next() -> Element? {
guard let iter = self.raw,
let rowPtr = rows_iter_next(iter) else {
let rowPtr = typed_value_result_set_iter_next(iter) else {
return nil
}
return TupleResult(raw: rowPtr)
@ -96,7 +96,7 @@ class RelResultIterator: OptionalRustObject, IteratorProtocol {
extension RelResult: Sequence {
func makeIterator() -> RelResultIterator {
do {
let rowIter = rows_iter(try self.validPointer())
let rowIter = typed_value_result_set_into_iter(try self.validPointer())
self.raw = nil
return RelResultIterator(iter: rowIter)
} catch {

View file

@ -51,7 +51,7 @@ class TupleResult: OptionalRustObject {
- Returns: The `Int64` at that index.
*/
func asLong(index: Int) -> Int64 {
return value_at_index_as_long(self.raw!, Int32(index))
return value_at_index_into_long(self.raw!, Int32(index))
}
/**
@ -64,7 +64,7 @@ class TupleResult: OptionalRustObject {
- Returns: The `Entid` at that index.
*/
func asEntid(index: Int) -> Entid {
return value_at_index_as_entid(self.raw!, Int32(index))
return value_at_index_into_entid(self.raw!, Int32(index))
}
/**
@ -77,7 +77,7 @@ class TupleResult: OptionalRustObject {
- Returns: The keyword `String` at that index.
*/
func asKeyword(index: Int) -> String {
return String(cString: value_at_index_as_kw(self.raw!, Int32(index)))
return String(cString: value_at_index_into_kw(self.raw!, Int32(index)))
}
/**
@ -90,7 +90,7 @@ class TupleResult: OptionalRustObject {
- Returns: The `Bool` at that index.
*/
func asBool(index: Int) -> Bool {
return value_at_index_as_boolean(self.raw!, Int32(index)) == 0 ? false : true
return value_at_index_into_boolean(self.raw!, Int32(index)) == 0 ? false : true
}
/**
@ -103,7 +103,7 @@ class TupleResult: OptionalRustObject {
- Returns: The `Double` at that index.
*/
func asDouble(index: Int) -> Double {
return value_at_index_as_double(self.raw!, Int32(index))
return value_at_index_into_double(self.raw!, Int32(index))
}
/**
@ -116,7 +116,7 @@ class TupleResult: OptionalRustObject {
- Returns: The `Date` at that index.
*/
func asDate(index: Int) -> Date {
return Date(timeIntervalSince1970: TimeInterval(value_at_index_as_timestamp(self.raw!, Int32(index))))
return Date(timeIntervalSince1970: TimeInterval(value_at_index_into_timestamp(self.raw!, Int32(index))))
}
/**
@ -129,7 +129,7 @@ class TupleResult: OptionalRustObject {
- Returns: The `String` at that index.
*/
func asString(index: Int) -> String {
return String(cString: value_at_index_as_string(self.raw!, Int32(index)))
return String(cString: value_at_index_into_string(self.raw!, Int32(index)))
}
/**
@ -142,7 +142,7 @@ class TupleResult: OptionalRustObject {
- Returns: The `UUID` at that index.
*/
func asUUID(index: Int) -> UUID? {
return UUID(uuid: value_at_index_as_uuid(self.raw!, Int32(index)).pointee)
return UUID(uuid: value_at_index_into_uuid(self.raw!, Int32(index)).pointee)
}
override func cleanup(pointer: OpaquePointer) {
@ -192,7 +192,7 @@ class ColResultIterator: OptionalRustObject, IteratorProtocol {
func next() -> Element? {
guard let iter = self.raw,
let rowPtr = values_iter_next(iter) else {
let rowPtr = typed_value_list_iter_next(iter) else {
return nil
}
return TypedValue(raw: rowPtr)
@ -211,7 +211,7 @@ extension ColResult: Sequence {
guard let raw = self.raw else {
return ColResultIterator(iter: nil)
}
let rowIter = values_iter(raw)
let rowIter = typed_value_list_into_iter(raw)
return ColResultIterator(iter: rowIter)
}
}

View file

@ -139,31 +139,31 @@ struct Result*_Nonnull query_builder_execute_coll(struct Query*_Nonnull query);
struct Result*_Nonnull query_builder_execute_tuple(struct Query*_Nonnull query);
// Query Result Processing
int64_t typed_value_as_long(struct TypedValue*_Nonnull value);
int64_t typed_value_as_entid(struct TypedValue*_Nonnull value);
const char* _Nonnull typed_value_as_kw(struct TypedValue*_Nonnull value);
int32_t typed_value_as_boolean(struct TypedValue*_Nonnull value);
double typed_value_as_double(struct TypedValue*_Nonnull value);
int64_t typed_value_as_timestamp(struct TypedValue*_Nonnull value);
const char* _Nonnull typed_value_as_string(struct TypedValue*_Nonnull value);
const uuid_t* _Nonnull typed_value_as_uuid(struct TypedValue*_Nonnull value);
int64_t typed_value_into_long(struct TypedValue*_Nonnull value);
int64_t typed_value_into_entid(struct TypedValue*_Nonnull value);
const char* _Nonnull typed_value_into_kw(struct TypedValue*_Nonnull value);
int32_t typed_value_into_boolean(struct TypedValue*_Nonnull value);
double typed_value_into_double(struct TypedValue*_Nonnull value);
int64_t typed_value_into_timestamp(struct TypedValue*_Nonnull value);
const char* _Nonnull typed_value_into_string(struct TypedValue*_Nonnull value);
const uuid_t* _Nonnull typed_value_into_uuid(struct TypedValue*_Nonnull value);
enum ValueType typed_value_value_type(struct TypedValue*_Nonnull value);
struct QueryResultRow* _Nullable row_at_index(struct QueryResultRows* _Nonnull rows, const int32_t index);
struct QueryRowsIterator* _Nonnull rows_iter(struct QueryResultRows* _Nonnull rows);
struct QueryResultRow* _Nullable rows_iter_next(struct QueryRowsIterator* _Nonnull iter);
struct QueryRowIterator* _Nonnull values_iter(struct QueryResultRow* _Nonnull row);
struct TypedValue* _Nullable values_iter_next(struct QueryRowIterator* _Nonnull iter);
struct QueryRowsIterator* _Nonnull typed_value_result_set_into_iter(struct QueryResultRows* _Nonnull rows);
struct QueryResultRow* _Nullable typed_value_result_set_iter_next(struct QueryRowsIterator* _Nonnull iter);
struct QueryRowIterator* _Nonnull typed_value_list_into_iter(struct QueryResultRow* _Nonnull row);
struct TypedValue* _Nullable typed_value_list_iter_next(struct QueryRowIterator* _Nonnull iter);
struct TypedValue* _Nonnull value_at_index(struct QueryResultRow* _Nonnull row, const int32_t index);
int64_t value_at_index_as_long(struct QueryResultRow* _Nonnull row, const int32_t index);
int64_t value_at_index_as_entid(struct QueryResultRow* _Nonnull row, const int32_t index);
const char* _Nonnull value_at_index_as_kw(struct QueryResultRow* _Nonnull row, const int32_t index);
int32_t value_at_index_as_boolean(struct QueryResultRow* _Nonnull row, const int32_t index);
double value_at_index_as_double(struct QueryResultRow* _Nonnull row, const int32_t index);
int64_t value_at_index_as_timestamp(struct QueryResultRow* _Nonnull row, const int32_t index);
const char* _Nonnull value_at_index_as_string(struct QueryResultRow* _Nonnull row, const int32_t index);
const uuid_t* _Nonnull value_at_index_as_uuid(struct QueryResultRow* _Nonnull row, const int32_t index);
int64_t value_at_index_into_long(struct QueryResultRow* _Nonnull row, const int32_t index);
int64_t value_at_index_into_entid(struct QueryResultRow* _Nonnull row, const int32_t index);
const char* _Nonnull value_at_index_into_kw(struct QueryResultRow* _Nonnull row, const int32_t index);
int32_t value_at_index_into_boolean(struct QueryResultRow* _Nonnull row, const int32_t index);
double value_at_index_into_double(struct QueryResultRow* _Nonnull row, const int32_t index);
int64_t value_at_index_into_timestamp(struct QueryResultRow* _Nonnull row, const int32_t index);
const char* _Nonnull value_at_index_into_string(struct QueryResultRow* _Nonnull row, const int32_t index);
const uuid_t* _Nonnull value_at_index_into_uuid(struct QueryResultRow* _Nonnull row, const int32_t index);
// Transaction change lists
const struct TxChange* _Nullable tx_change_list_entry_at(const struct TxChangeList* _Nonnull list, size_t index);