I would like to create a fixed size buffer that I can use to read from IO.
// this does not compile, just a jist of what I am looking at doing.
let cookie : String = my_cookie_fn();
let cookie = cookie.as_bytes();
let mut buf = [0u8, cookie.len()]; // this will not work as the size has to be known at compile time
result = IO.read_exact(buf);
if Ok(result) && buf == cookie {
// it matches!
}
I can't use a vec![0, var] because I want to use the read_exact() fn which requires a buf of exactly n bytes. I don't know the size at compile time so I am having a hard time figuring out how to use the read_exact() fn.