I wrote myself into a corner in Rust.

I have an object "vim"; it's never made mut, it's only passed around and when you need to change it you make a new one.

At a certain point, I *may* have come up with an update to vim's field current_file. I represent this with

let current_file = current_file_update.or(vim.current_file);

…but this statement "moves" current file out of vim. So look at these three match clauses; three want current_file but not vim, three want vim but not current_file. (1/2)

Follow

@mcc this sounds similar to the reason why some types have an into_parts method and a corresponding from_parts "constructor".

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.