forge_util

Crates.ioforge_util
lib.rsforge_util
version0.1.3
sourcesrc
created_at2019-10-12 02:41:17.25179
updated_at2019-10-21 00:22:01.605884
descriptionThe rust language implementation of forge_util
homepagehttps://github.com/ArcBlock/forge-rust-sdk
repositoryhttps://github.com/ArcBlock/forge-rust-sdk
max_upload_size
id171824
size4,277
Pang Wei (qiangshou007)

documentation

https://docs.rs/forge-rust-sdk

README

forge_util introduction

Intro

forge_util implement by Rust. Provide apis to save a Json in local.

Help user

APIs

    /// save Json to local
    /// value: Json to save.
    /// path: local path where to save, `empty` will save to default path `./settings.json`
    config_save_settings(value: &Value, path: &str) -> Result<()>
    /// get Json from local
    /// path: Json file local path, `empty` will use default path `./settings.json`
    config_get_settings(path: &str) -> Result<Value>

Example

    let people = serde_json::json!({"name":"alice","age":18,"sex":true});
    let path = "./config_test.json";
    config_save_settings(&people, path)?;
    assert_eq!(people, config_get_settings(path)?);

Example above will create a Json file ./config_test.json: ./config_test.json:

    {
        "age": 18,
        "name": "alice",
        "sex": true
    }
Commit count: 0

cargo fmt