Turn a nullable type into a Result.
For a nullable type T?, toResult returns a Failure when the receiver is null and Success otherwise.
T?
null
the corresponding result for the receiver.
an element of type T?.
the type of the receiver.