I expect Rust should be able to handle this nicely, but I'm more familiar with Pony... So here's how to do it nicely in it:
fun f(x: (T1 | T2 | None)): ReturnType =>
match x
| T2 => /* do something */
| T1 => /* do something else */
| None => /* Handle badly behaved. Optional to have, compiler can enforce good behaviour if you want. */