Rust, extract time from ode solvers

Learning Rust, have a small toy compartmental model that runs fine, have copied various other peoples work. It uses a crate called ode_solvers which iteratively solves a system of differential equations, over time so the dependent variable is time. This is the code at the beginning of the ode_solver section:

impl ode_solvers::System<f64, State> for TwoPool {
    fn system(&self, _: Time, y: &State, dy: &mut State) {

further down I have this code and it works, printing out the values of state variables as the model runs, just diagnostics at early stages. What I can not extract, and thus print out, is the value of time at each stage because I don't know what the independent variable (time) is actually called.

	// print the outputs of the model at each integration iteration 
	println!("PoolSizes  t{:.3}, A={:.3}, B={:.3}, Tot={:.3}", Time,y[0], y[1], y[2]);	

This code works, prints the value of state variables A, B and Tot at each iteration but fails with the variable "Time". Any suggestions about where/how to find out what the correct name of Time is in this case to extract it? Thx. J>

_ is a special pattern that means "don't bind the value to any variable". So it doesn't have a name. Change _ to a name instead.

fn system(&self, time: Time, y: &State, dy: &mut State) 
2 Likes

Works great, Thx. J