I have this example code:
use postcard;
use serde;
pub fn main()
{
#[derive(Debug, serde::Serialize, serde::Deserialize)]
struct Object
{
x : u16,
y : u16,
}
//const VERSION: &'static str = "0.0.1";
const VERSION: f32= 0.1;
let rect = Object{x: 10, y: 20};
fn save(object: &Object)
{
let data = postcard::to_vec(object);
}
}
in this line let data = postcard::to_vec(object);
I am getting an error that states:
|
20 | let data = postcard::to_vec(object);
| ^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `B` declared on the function `to_vec`
Not too sure why I am getting this issue?