req.url.fragment
is an optional String
. If it has a value, I want to copy that value into fragment
, otherwise I want to assign an empty string. I keep getting the error that I cannot move out of borrowed content
.
How do I resolve this?
fn fb_token(req: &mut Request) -> IronResult<Response> {
let fragment = match req.url.fragment {
Some(fragment) => fragment,
None => "".to_string(),
};
Ok(Response::with((status::Ok, fragment)))
}