Use std::time::Duration to represent the time span and subtract two Instant values to calculate the difference.
use std::time::{Duration, Instant};
fn main() {
let start = Instant::now();
// Simulate work
std::thread::sleep(Duration::from_secs(2));
let end = Instant::now();
let duration = end - start;
println!("Elapsed: {:?}", duration);
}