run rustfmt

This commit is contained in:
Alexander Bulaev
2020-03-18 13:59:22 +03:00
parent efe9272816
commit 4630f44d6c
11 changed files with 808 additions and 710 deletions

View File

@@ -3,9 +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

@@ -1,30 +1,31 @@
#[macro_use] extern crate serde_json;
#[macro_use]
extern crate serde_json;
extern crate splines;
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);
}