amagi 0.1.2

Rust SDK, CLI, and Web API service skeleton for multi-platform social web adapters.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::error::AppError;

pub(super) fn interpolate(from: &[f64], to: &[f64], factor: f64) -> Result<Vec<f64>, AppError> {
    if from.len() != to.len() {
        return Err(AppError::InvalidRequestConfig(format!(
            "twitter interpolation requires arrays of the same length, got {} and {}",
            from.len(),
            to.len()
        )));
    }

    Ok(from
        .iter()
        .zip(to.iter())
        .map(|(from, to)| from * (1.0 - factor) + to * factor)
        .collect())
}