mirror of
https://github.com/fluencelabs/examples
synced 2025-04-25 10:42:16 +00:00
bump version
This commit is contained in:
parent
07c07d9c40
commit
4eae93272e
@ -16,7 +16,7 @@ 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"
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
* 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!();
|
||||||
|
|
||||||
@ -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(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user