假设我有一个类型为
我尝试使用
但是我遇到了错误:
Option<T>
的值x
,如何将其转换为Option<&T>
?我尝试使用
map
:let result = x.map(|x| &x)
^^ Error
但是我遇到了错误:
cannot return reference to function parameter `x`
returns a reference to data owned by the current function