Skip to main content

Module serde_arrays

Module serde_arrays 

Source
Expand description

Serde helpers for const-generic fixed-size arrays.

This is the one shared set of fixed-array serde helpers for the workspace. Use a module with #[serde(with = "repose_kinematics::serde_arrays::<module>")] on a [T; N] field; each module provides serialize and deserialize, encodes the array as a tuple of exactly N elements, and rejects sequences of any other length.

use repose_kinematics::CuJointPosition;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
struct Goal<const N: usize> {
    #[serde(with = "repose_kinematics::serde_arrays::position_array")]
    positions: [CuJointPosition; N],
}

Modulesยง

acceleration_array
Serde with module for [CuJointAcceleration; N] arrays.
angle_array
Serde with module for [Angle64; N] arrays.
angular_velocity_array
Serde with module for [AngularVelocity64; N] arrays.
jerk_array
Serde with module for [CuJointJerk; N] arrays.
joint_spec_array
Serde with module for [CuJointSpec; N] arrays.
position_array
Serde with module for [CuJointPosition; N] arrays.
velocity_array
Serde with module for [CuJointVelocity; N] arrays.