bump version

This commit is contained in:
boneyard93501 2021-09-01 18:32:57 -05:00
parent 07c07d9c40
commit 4eae93272e
2 changed files with 27 additions and 11 deletions

View File

@ -11,12 +11,12 @@ name = "process_files"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
marine-rs-sdk = { version="0.6.11", features=["logger"] } marine-rs-sdk = { version = "0.6.11", features = ["logger"] }
log = "0.4.14" log = "0.4.14"
rand = "0.8.4" rand = "0.8.4"
[dev-dependencies] [dev-dependencies]
marine-rs-sdk-test = "0.1.11" marine-rs-sdk-test = "0.2.0"
[profile.release] [profile.release]
opt-level = "s" opt-level = "s"

View File

@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
use marine_rs_sdk::{marine, module_manifest, get_call_parameters}; use marine_rs_sdk::{get_call_parameters, marine, module_manifest};
use std::path::{PathBuf, Path};
use rand::Rng;
use rand::distributions::Alphanumeric; use rand::distributions::Alphanumeric;
use rand::Rng;
use std::path::{Path, PathBuf};
module_manifest!(); module_manifest!();
pub fn main() { } pub fn main() {}
#[marine] #[marine]
pub struct SizeResult { pub struct SizeResult {
@ -33,8 +33,16 @@ pub struct SizeResult {
#[marine] #[marine]
pub fn file_size(file_path: String) -> SizeResult { pub fn file_size(file_path: String) -> SizeResult {
match std::fs::read(file_path) { match std::fs::read(file_path) {
Ok(bytes) => SizeResult { size: bytes.len() as _, success: true, error: String::new() }, Ok(bytes) => SizeResult {
Err(err) => SizeResult { size: 0, success: false, error: err.to_string() }, size: bytes.len() as _,
success: true,
error: String::new(),
},
Err(err) => SizeResult {
size: 0,
success: false,
error: err.to_string(),
},
} }
} }
@ -56,8 +64,16 @@ pub fn write_file_size(size: u32) -> WriteResult {
let file = vault_dir().join(&name); let file = vault_dir().join(&name);
let file_str = file.to_string_lossy().to_string(); let file_str = file.to_string_lossy().to_string();
match std::fs::write(&file, size.to_string()) { match std::fs::write(&file, size.to_string()) {
Ok(_) => WriteResult { path: file_str, success: true, error: String::new() }, Ok(_) => WriteResult {
Err(err) => WriteResult { path: String::new(), success: false, error: err.to_string() } path: file_str,
success: true,
error: String::new(),
},
Err(err) => WriteResult {
path: String::new(),
success: false,
error: err.to_string(),
},
} }
} }