From 3d8c1db669fdfdf56de693da4d76d3df9b8e5d08 Mon Sep 17 00:00:00 2001 From: Elise Chouleur Date: Tue, 28 Oct 2025 17:01:36 +0100 Subject: [PATCH 1/2] feat: Add iOS Simulator arm64 (aarch64-apple-ios-sim) support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detect simulator targets by checking TARGET string for "sim" or "x86_64" and select the correct CouchbaseLite framework variant accordingly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- build.rs | 8 +++++--- src/blob.rs | 2 +- src/error.rs | 8 ++++---- src/fleece_mutable.rs | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/build.rs b/build.rs index 607e7b4..50db832 100644 --- a/build.rs +++ b/build.rs @@ -210,9 +210,11 @@ fn configure_rustc() -> Result<(), Box> { let target_os = env::var("CARGO_CFG_TARGET_OS")?; if target_os == "ios" { let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("Can't read target_arch"); - let ios_framework = match target_arch.as_str() { - "aarch64" => "ios-arm64", - "x86_64" => "ios-arm64_x86_64-simulator", + // Check if this is a simulator target by looking at the full TARGET string + let is_simulator = target_dir.contains("sim") || target_dir.contains("x86_64"); + let ios_framework = match (target_arch.as_str(), is_simulator) { + ("aarch64", false) => "ios-arm64", + ("aarch64", true) | ("x86_64", _) => "ios-arm64_x86_64-simulator", _ => panic!("Unsupported ios target"), }; diff --git a/src/blob.rs b/src/blob.rs index bfcc660..84605d9 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -114,7 +114,7 @@ impl Blob { } /// Opens a stream for reading a blob's content from disk. - pub fn open_content(&self) -> Result { + pub fn open_content(&self) -> Result> { check_ptr( |err| unsafe { CBLBlob_OpenContentStream(self.get_ref(), err) }, |stream| BlobReader { diff --git a/src/error.rs b/src/error.rs index 8d3f851..77a849c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -249,10 +249,10 @@ impl Error { /// Returns a message describing an error. pub fn message(&self) -> String { - if let ErrorCode::CouchbaseLite(e) = self.code { - if e == CouchbaseLiteError::UntranslatableError { - return "Unknown error".to_string(); - } + if let ErrorCode::CouchbaseLite(e) = self.code + && e == CouchbaseLiteError::UntranslatableError + { + return "Unknown error".to_string(); } unsafe { CBLError_Message(&self.as_cbl_error()) diff --git a/src/fleece_mutable.rs b/src/fleece_mutable.rs index 876351f..b7a3bf2 100644 --- a/src/fleece_mutable.rs +++ b/src/fleece_mutable.rs @@ -96,7 +96,7 @@ impl MutableArray { unsafe { FLMutableArray_IsChanged(self.get_ref()) } } - pub fn at(&mut self, index: u32) -> Option { + pub fn at(&mut self, index: u32) -> Option> { if self.count() > index { Some(unsafe { Slot { @@ -109,7 +109,7 @@ impl MutableArray { } } - pub fn append(&mut self) -> Slot { + pub fn append(&mut self) -> Slot<'_> { unsafe { Slot { cbl_ref: FLMutableArray_Append(self.get_ref()), From 2738b3d4ecfd2034e32a69f291da87f9bc36459c Mon Sep 17 00:00:00 2001 From: Elise Chouleur Date: Fri, 31 Oct 2025 23:22:44 +0100 Subject: [PATCH 2/2] Revert unwanted diff --- src/blob.rs | 2 +- src/error.rs | 8 ++++---- src/fleece_mutable.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/blob.rs b/src/blob.rs index 84605d9..bfcc660 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -114,7 +114,7 @@ impl Blob { } /// Opens a stream for reading a blob's content from disk. - pub fn open_content(&self) -> Result> { + pub fn open_content(&self) -> Result { check_ptr( |err| unsafe { CBLBlob_OpenContentStream(self.get_ref(), err) }, |stream| BlobReader { diff --git a/src/error.rs b/src/error.rs index 77a849c..8d3f851 100644 --- a/src/error.rs +++ b/src/error.rs @@ -249,10 +249,10 @@ impl Error { /// Returns a message describing an error. pub fn message(&self) -> String { - if let ErrorCode::CouchbaseLite(e) = self.code - && e == CouchbaseLiteError::UntranslatableError - { - return "Unknown error".to_string(); + if let ErrorCode::CouchbaseLite(e) = self.code { + if e == CouchbaseLiteError::UntranslatableError { + return "Unknown error".to_string(); + } } unsafe { CBLError_Message(&self.as_cbl_error()) diff --git a/src/fleece_mutable.rs b/src/fleece_mutable.rs index b7a3bf2..876351f 100644 --- a/src/fleece_mutable.rs +++ b/src/fleece_mutable.rs @@ -96,7 +96,7 @@ impl MutableArray { unsafe { FLMutableArray_IsChanged(self.get_ref()) } } - pub fn at(&mut self, index: u32) -> Option> { + pub fn at(&mut self, index: u32) -> Option { if self.count() > index { Some(unsafe { Slot { @@ -109,7 +109,7 @@ impl MutableArray { } } - pub fn append(&mut self) -> Slot<'_> { + pub fn append(&mut self) -> Slot { unsafe { Slot { cbl_ref: FLMutableArray_Append(self.get_ref()),