Skip to content

Commit

Permalink
chore: rename api to avoid swift keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Oct 19, 2023
1 parent e1e1aed commit adf9967
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public final boolean is_error() {
}
private static native @NonNull String do_get_sync_state(long self);

public final boolean init(@NonNull String workspace_id, @NonNull byte [] data) {
boolean ret = do_init(mNativeObj, workspace_id, data);
public final boolean import(@NonNull String workspace_id, @NonNull byte [] data) {
boolean ret = do_import(mNativeObj, workspace_id, data);

return ret;
}
private static native boolean do_init(long self, @NonNull String workspace_id, byte [] data);
private static native boolean do_import(long self, @NonNull String workspace_id, byte [] data);

public final byte [] export(@NonNull String workspace_id) {
byte [] ret = do_export(mNativeObj, workspace_id);
Expand Down
4 changes: 2 additions & 2 deletions libs/jwst-binding/jwst-jni/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ foreign_typemap!(
fn JwstStorage::is_finished(&self) -> bool;
fn JwstStorage::is_error(&self) -> bool;
fn JwstStorage::get_sync_state(&self) -> String;
fn JwstStorage::init(&mut self, workspace_id: String, data: &[u8]) -> bool; alias init;
fn JwstStorage::import(&mut self, workspace_id: String, data: &[u8]) -> bool; alias import;
fn JwstStorage::export(&mut self, workspace_id: String) -> Vec<u8>; alias export;
fn JwstStorage::connect(&mut self, workspace_id: String, remote: String) -> Option<Workspace>; alias connect;
fn JwstStorage::get_last_synced(&self) ->Vec<i64>;
Expand Down Expand Up @@ -132,7 +132,7 @@ foreign_class!(
!= fs::read_to_string(in_temp.with_extension("")).unwrap()
{
fs::copy(in_temp.with_extension("out"), in_temp.with_extension("")).unwrap();
fs::copy(in_temp.with_extension("out"), in_src).unwrap();
fs::copy(in_temp.with_extension("in"), in_src).unwrap();
}
}
}
2 changes: 1 addition & 1 deletion libs/jwst-binding/jwst-jni/src/java_glue.rs.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ foreign_class!(
fn JwstStorage::is_finished(&self) -> bool;
fn JwstStorage::is_error(&self) -> bool;
fn JwstStorage::get_sync_state(&self) -> String;
fn JwstStorage::init(&mut self, workspace_id: String, data: &[u8]) -> bool; alias init;
fn JwstStorage::import(&mut self, workspace_id: String, data: &[u8]) -> bool; alias import;
fn JwstStorage::export(&mut self, workspace_id: String) -> Vec<u8>; alias export;
fn JwstStorage::connect(&mut self, workspace_id: String, remote: String) -> Option<Workspace>; alias connect;
fn JwstStorage::get_last_synced(&self) ->Vec<i64>;
Expand Down
6 changes: 3 additions & 3 deletions libs/jwst-binding/jwst-jni/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ impl JwstStorage {
}
}

pub fn init(&mut self, workspace_id: String, data: &[u8]) -> bool {
match self.init_workspace(workspace_id, data) {
pub fn import(&mut self, workspace_id: String, data: &[u8]) -> bool {
match self.import_workspace(workspace_id, data) {
Ok(_) => true,
Err(e) => {
let error = format!("Failed to init workspace: {:?}", e);
Expand All @@ -103,7 +103,7 @@ impl JwstStorage {
}
}

fn init_workspace(&self, workspace_id: String, data: &[u8]) -> JwstStorageResult {
fn import_workspace(&self, workspace_id: String, data: &[u8]) -> JwstStorageResult {
let rt = Arc::new(
Builder::new_multi_thread()
.worker_threads(1)
Expand Down
2 changes: 1 addition & 1 deletion libs/jwst-binding/jwst-swift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ mod ffi {

fn get_sync_state(self: &Storage) -> String;

fn init(self: &mut Storage, workspace_id: String, data: Vec<u8>) -> bool;
fn import(self: &mut Storage, workspace_id: String, data: Vec<u8>) -> bool;

fn export(self: &mut Storage, workspace_id: String) -> Option<Vec<u8>>;

Expand Down
6 changes: 3 additions & 3 deletions libs/jwst-binding/jwst-swift/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ impl Storage {
}
}

pub fn init(&mut self, workspace_id: String, data: Vec<u8>) -> bool {
match self.init_workspace(workspace_id, data) {
pub fn import(&mut self, workspace_id: String, data: Vec<u8>) -> bool {
match self.import_workspace(workspace_id, data) {
Ok(_) => true,
Err(e) => {
let error = format!("Failed to init workspace: {:?}", e);
Expand All @@ -100,7 +100,7 @@ impl Storage {
}
}

fn init_workspace(&self, workspace_id: String, data: Vec<u8>) -> JwstStorageResult {
fn import_workspace(&self, workspace_id: String, data: Vec<u8>) -> JwstStorageResult {
let rt = Arc::new(
Builder::new_multi_thread()
.worker_threads(1)
Expand Down

0 comments on commit adf9967

Please sign in to comment.