Rust: Ref, Deref, Clone
To convert `Option<T>
` to `Option<&T>
` use `as_deref()
`
To convert `&Option<T>
` to `Option<&T>
` use `as_deref()
`
To convert `Option<&T>
` to `Option<T>
` use `cloned()
`
I don't know what is the difference between `as_ref()
` and `as_deref()
` when it comes to converting `&Option<T>
` to `Option<&T>
`.
Comments