Add rustfmt.toml and reformat.

This commit is contained in:
Dimitri Sabadie
2020-03-19 01:22:26 +01:00
parent 1bcf1de99e
commit 89dfb61272
11 changed files with 751 additions and 745 deletions

View File

@@ -3,12 +3,12 @@ extern crate splines;
use splines::{Interpolation, Key, Spline};
fn main() {
let keys = vec![
Key::new(0., 0., Interpolation::default()),
Key::new(5., 1., Interpolation::default()),
];
let spline = Spline::from_vec(keys);
let keys = vec![
Key::new(0., 0., Interpolation::default()),
Key::new(5., 1., Interpolation::default()),
];
let spline = Spline::from_vec(keys);
println!("value at 0: {:?}", spline.clamped_sample(0.));
println!("value at 3: {:?}", spline.clamped_sample(3.));
println!("value at 0: {:?}", spline.clamped_sample(0.));
println!("value at 3: {:?}", spline.clamped_sample(3.));
}

View File

@@ -6,26 +6,26 @@ use serde_json::from_value;
use splines::Spline;
fn main() {
let value = json! {
[
{
"t": 0,
"interpolation": "linear",
"value": 0
},
{
"t": 1,
"interpolation": { "step": 0.5 },
"value": 1
},
{
"t": 5,
"interpolation": "cosine",
"value": 10
},
]
};
let value = json! {
[
{
"t": 0,
"interpolation": "linear",
"value": 0
},
{
"t": 1,
"interpolation": { "step": 0.5 },
"value": 1
},
{
"t": 5,
"interpolation": "cosine",
"value": 10
},
]
};
let spline = from_value::<Spline<f32, f32>>(value);
println!("{:?}", spline);
let spline = from_value::<Spline<f32, f32>>(value);
println!("{:?}", spline);
}