From 64c19df614700d3086bd4caccb9fbfe7a7d3a616 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Mon, 4 Jul 2022 11:18:26 +0200 Subject: [PATCH] Enable a building on the iOS platform (#653) --- librocksdb-sys/build.rs | 13 ++++++++++++- src/db.rs | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/librocksdb-sys/build.rs b/librocksdb-sys/build.rs index 48af659..5eb0c27 100644 --- a/librocksdb-sys/build.rs +++ b/librocksdb-sys/build.rs @@ -147,7 +147,18 @@ fn build_rocksdb() { lib_sources.push("util/crc32c_arm64.cc") } - if target.contains("darwin") { + if target.contains("apple-ios") { + config.define("OS_MACOSX", None); + + config.define("IOS_CROSS_COMPILE", None); + config.define("PLATFORM", "IOS"); + config.define("NIOSTATS_CONTEXT", None); + config.define("NPERF_CONTEXT", None); + config.define("ROCKSDB_PLATFORM_POSIX", None); + config.define("ROCKSDB_LIB_IO_POSIX", None); + + env::set_var("IPHONEOS_DEPLOYMENT_TARGET", "11.0"); + } else if target.contains("darwin") { config.define("OS_MACOSX", None); config.define("ROCKSDB_PLATFORM_POSIX", None); config.define("ROCKSDB_LIB_IO_POSIX", None); diff --git a/src/db.rs b/src/db.rs index 9b4d3b5..83c564d 100644 --- a/src/db.rs +++ b/src/db.rs @@ -992,20 +992,20 @@ impl DBWithThreadMode { } /// Return the values associated with the given keys and column families. - pub fn multi_get_cf<'a, 'b: 'a, K, I, W: 'b>( + pub fn multi_get_cf<'a, 'b: 'a, K, I, W>( &'a self, keys: I, ) -> Vec>, Error>> where K: AsRef<[u8]>, I: IntoIterator, - W: AsColumnFamilyRef, + W: 'b + AsColumnFamilyRef, { self.multi_get_cf_opt(keys, &ReadOptions::default()) } /// Return the values associated with the given keys and column families using read options. - pub fn multi_get_cf_opt<'a, 'b: 'a, K, I, W: 'b>( + pub fn multi_get_cf_opt<'a, 'b: 'a, K, I, W>( &'a self, keys: I, readopts: &ReadOptions, @@ -1013,7 +1013,7 @@ impl DBWithThreadMode { where K: AsRef<[u8]>, I: IntoIterator, - W: AsColumnFamilyRef, + W: 'b + AsColumnFamilyRef, { let (cfs_and_keys, keys_sizes): (Vec<(_, Box<[u8]>)>, Vec<_>) = keys .into_iter()