-
Notifications
You must be signed in to change notification settings - Fork 569
Deref, Index, and InArc lenses #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
edbc31b
to
6bb1c41
Compare
945ecb2
to
df63e6f
Compare
a811626
to
70e0f84
Compare
druid/src/lens.rs
Outdated
/// ``` | ||
fn make_mut<L, C, D>(self, lens: L) -> MakeMut<Self, L, C> | ||
where | ||
Self: Sized + Lens<A, Arc<C>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a hack, but it works.
13df44f
to
affb5be
Compare
/// lens.put(&mut x, 42); | ||
/// assert_eq!(&*x, &[0, 1, 42, 3]); | ||
/// ``` | ||
fn in_arc(self) -> InArc<Self> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bikeshedding still welcome, though I think this is probably adequate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of anything better? maybe just arc
, but either or.
4ed9487
to
6712b84
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Builds on #344.
Note that this does not provide a way to index into an
Arc<Vec<T>>
. That's intentional, as any such operation would cause a deep copy in everyWidget::event
.