Skip to content

Instantly share code, notes, and snippets.

@raphlinus
Created July 5, 2019 20:19
Show Gist options
  • Save raphlinus/58cbc8916b2c4bde4bac8e8cc88609cd to your computer and use it in GitHub Desktop.
Save raphlinus/58cbc8916b2c4bde4bac8e8cc88609cd to your computer and use it in GitHub Desktop.
Sketch of lens trait
pub trait Lens<T, U> {
fn get<'a>(&self, data: &'a T) -> &'a U;
fn with_mut<F: FnOnce(&mut U)>(&self, data: &mut T, f: F);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment