@af @sir It's like a switch statement in C but instead of the cases being values they are types. It's called pattern matching if you want to learn more about it, there are a lot of really cool things that pattern matching can do.
In this case it looks like it is being used as a way to handle errors by matching against an error type, or succeeding by matching against some value otherwise.