Hey,
Trying to get a CAN reader working, using 'socketcan-alt' and storing the data packets in a variable for future calculations.
It works until:
println!("CAN Output: {}", canout);
When it presents me with the following error underneath canout
for<'r> fn(&'r socketcan_alt::DataFrame) -> &'r [u8] {socketcan_alt::DataFrame::data}` cannot be formatted with the default formatter
Do I need to use std::Format or something like that?
Thanks in advance!
Logan
.
.
.
Below is the whole code:
use socketcan_alt::{*,Frame};
use std::ffi::CString;
use std::io::Result;
use std::sync::Arc;
use std::fmt::Display;
use std::thread;
use std::time::Duration;
use structopt::StructOpt;
#[derive(StructOpt)]
struct Opt {
ifname: String,
}
fn main() -> Result<()> {
let opt = Opt::from_args();
let socket = Arc::new(Socket::bind(CString::new(opt.ifname)?)?);
socket.set_recv_own_msgs(true)?;
socket.set_fd_frames(true)?;
{
let socket = socket.clone();
thread::spawn(move || -> Result<()> {
loop {
let canraw = socket.recv()?;
let canout = DataFrame::data;
println!("CAN Output: {}", canout);
}
});
}