What is an example of contravariant use in Rust?
In the Nomicon's section about subtyping , it says contravariance is available for a function pointer type. However, I can't find any good examples of this. I tried to code a struct with a function pointer, but the contravariance doesn't seem to work. What is a code example of this? Rust's notion of subtyping only applies to lifetimes . Searching for the term "contra" on the page you linked has numerous relevant paragraphs: Actually witnessing contravariance is quite difficult in Rust, though it does in fact exist. NOTE: the only source of contravariance in the language is the arguments to a