Option <---> Optional
Rust's Option
is seen on the Swift side as a Swift Optional
.
Example
// Swift
func call_rust_and_divide_by_2() -> Optional<UInt8> {
if case let val? = make_rust_option() {
return val / 2
} else {
nil
}
}
func make_swift_optional() -> Bool? {
true
}