Rust, todo Macro

Mike Code
Apr 28, 2024

--

Sometimes, we define a function or a method ,with returning type. But for now we do not decide how to write code in this function or method . If we leave this function or method’s body empty, compiler will give us an error. So we can add todo macro in function or method’s body to pass type analysis, compiler will not give us an error. And our code can compile and run.

fn hello(a: i32) -> i32 {
todo!()
}

--

--