From a28813fb2ee249d73ce88c9606a07abba3347d7a Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Sun, 16 Jan 2022 14:06:30 -0500 Subject: [PATCH] rust fmt --- build.rs | 11 ++++++++--- examples/echobot.rs | 2 +- src/bindings_go.rs | 2 +- src/cwtchlib_go/mod.rs | 2 +- src/lib.rs | 26 +++++++++++++++++++++++--- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/build.rs b/build.rs index f8d4825..6a64a47 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,6 @@ -use std::process::Command; use std::env; use std::path::Path; +use std::process::Command; fn main() { let out_dir = env::var_os("OUT_DIR").unwrap(); @@ -12,5 +12,10 @@ fn main() { let lib_cwtch_path = Path::new(&out_dir).join("libCwtch.so"); // https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.5.4 - Command::new("wget").arg("https://git.openprivacy.ca/attachments/dd3c6b41-98e4-4e7b-81af-d21893bfe389").arg("-O").arg(lib_cwtch_path).output().expect("failed to download libCwtch.so"); -} \ No newline at end of file + Command::new("wget") + .arg("https://git.openprivacy.ca/attachments/dd3c6b41-98e4-4e7b-81af-d21893bfe389") + .arg("-O") + .arg(lib_cwtch_path) + .output() + .expect("failed to download libCwtch.so"); +} diff --git a/examples/echobot.rs b/examples/echobot.rs index d2fc292..fb0aef3 100644 --- a/examples/echobot.rs +++ b/examples/echobot.rs @@ -7,7 +7,7 @@ use libcwtch::CwtchLib; fn main() { let bot_home = "example_cwtch_dir"; match std::fs::remove_dir_all(&bot_home) { - _ => () + _ => (), } std::fs::create_dir_all(&bot_home).expect("Error creating bot_home directory"); diff --git a/src/bindings_go.rs b/src/bindings_go.rs index 9f28e4d..ed1610d 100644 --- a/src/bindings_go.rs +++ b/src/bindings_go.rs @@ -80,7 +80,7 @@ macro_rules! c_bind { pub struct CwtchLibGo {} -impl CwtchLib for CwtchLibGo { +impl CwtchLib for CwtchLibGo { c_bind!(start_cwtch(app_dir: &str, tor_path: &str;;) c_StartCwtch -> i32); c_bind!(send_app_event(event_json: &str;;) c_SendAppEvent); c_bind!(send_profile_event(profile: &str, event_jason: &str;;) c_SendProfileEvent); diff --git a/src/cwtchlib_go/mod.rs b/src/cwtchlib_go/mod.rs index 52fb393..df69845 100644 --- a/src/cwtchlib_go/mod.rs +++ b/src/cwtchlib_go/mod.rs @@ -4,4 +4,4 @@ #![allow(dead_code)] #![allow(deref_nullptr)] -pub mod bindings; \ No newline at end of file +pub mod bindings; diff --git a/src/lib.rs b/src/lib.rs index 6f16913..2bd6cbc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,7 +45,12 @@ pub trait CwtchLib { fn get_message_by_id(&self, profile: &str, conversation_id: i32, message_id: i32) -> String; /// Get a specific message for conversation of profile by hash - fn get_message_by_content_hash(&self, profile: &str, conversation_id: i32, hash: &str) -> String; + fn get_message_by_content_hash( + &self, + profile: &str, + conversation_id: i32, + hash: &str, + ) -> String; /// Send json of a structs::Message from profile to contact fn send_message(&self, profile: &str, conversation_id: i32, msg: &str); @@ -57,7 +62,14 @@ pub trait CwtchLib { fn share_file(&self, profile: &str, conversation_id: i32, file_path: &str); /// download a file from a conversation to the file_path - fn download_file(&self, profile: &str, conversation_id: i32, file_path: &str, manifest_path: &str, file_key: &str); + fn download_file( + &self, + profile: &str, + conversation_id: i32, + file_path: &str, + manifest_path: &str, + file_key: &str, + ); /// Query the status of a download fn check_download_status(&self, profile: &str, file_key: &str); @@ -90,7 +102,15 @@ pub trait CwtchLib { fn set_conversation_attribute(&self, profile: &str, conversation_id: i32, key: &str, val: &str); /// Set an attribute on a message in a conversation - fn set_message_attribute(&self, profile: &str, conversation_id: i32, channel_id: i32, message_id: i32, attribute_key: &str, attribute_value: &str); + fn set_message_attribute( + &self, + profile: &str, + conversation_id: i32, + channel_id: i32, + message_id: i32, + attribute_key: &str, + attribute_value: &str, + ); /// Change a profile's password to new_pass if old_pass is correct fn change_password(&self, profile: &str, old_pass: &str, new_pass: &str, new_pass_again: &str);