You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using an enum for the Model of your app is probably more idiomatic, but working with it with the borrow checker is harder.
Here is what you could do for State::WaitingForDownload(blob)
fngive_me_blob(&mutState) -> Option<blob>{// FIXME: reset state only if in State ::WaitingForDownloadlet old_state = std::mem::replace(self.state,State::Downloading);match old_state {WaitingForDownload(blob) => Some(blob),
_ => None}}
Using an enum for the
Model
of your app is probably more idiomatic, but working with it with the borrow checker is harder.Here is what you could do for
State::WaitingForDownload(blob)
Here is an exemple:
https://rust-unofficial.github.io/patterns/idioms/mem-replace.html
The text was updated successfully, but these errors were encountered: