Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
sehz committed Sep 26, 2023
1 parent ccbbc51 commit 7b4d42e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/async-cb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ async fn hello<F: Fn(f64, String)>(seconds: i32, cb: F) {
// println!("woke from time");

cb(10.0, "hello world".to_string());
}
}
1 change: 0 additions & 1 deletion examples/js-env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ impl TryIntoJs for EnvInterceptor {
js_env.create_double(self.0 * 2.0)
}
}

28 changes: 11 additions & 17 deletions examples/json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ use serde_json::map::Map;
#[node_bindgen]
struct StandardJson {
some_name: String,
a_number: i64
a_number: i64,
}

#[node_bindgen]
struct Outer {
val: Inner
val: Inner,
}

#[node_bindgen]
Expand All @@ -29,19 +29,17 @@ struct UnitStruct;
#[node_bindgen]
enum ErrorType {
WithMessage(String, usize),
WithFields {
val: usize
},
UnitError
WithFields { val: usize },
UnitError,
}

#[node_bindgen]
struct WithSerdeJson {
val: Value
val: Value,
}

struct CustomJson {
val: f64
val: f64,
}

impl TryIntoJs for CustomJson {
Expand All @@ -67,14 +65,14 @@ fn custom_json() -> CustomJson {
fn standard_json() -> StandardJson {
StandardJson {
some_name: "John".to_owned(),
a_number: 1337
a_number: 1337,
}
}

#[node_bindgen]
fn multilevel_json() -> Outer {
Outer {
val: Inner("hello".to_owned())
val: Inner("hello".to_owned()),
}
}

Expand All @@ -90,9 +88,7 @@ fn with_message() -> ErrorType {

#[node_bindgen]
fn with_fields() -> ErrorType {
ErrorType::WithFields {
val: 123
}
ErrorType::WithFields { val: 123 }
}

#[node_bindgen]
Expand All @@ -102,9 +98,7 @@ fn with_unit() -> ErrorType {

#[node_bindgen]
fn failed_result_with_fields() -> Result<(), ErrorType> {
Err(ErrorType::WithFields {
val: 987
})
Err(ErrorType::WithFields { val: 987 })
}

#[node_bindgen]
Expand All @@ -119,6 +113,6 @@ fn with_serde_json() -> WithSerdeJson {
map.insert("second".to_owned(), Value::String("hello".to_owned()));

WithSerdeJson {
val: Value::Object(map)
val: Value::Object(map),
}
}

0 comments on commit 7b4d42e

Please sign in to comment.