make target an associated type

This commit is contained in:
Evan Almloff committed 2024-02-07 08:53:21 -06:00
1 parent ef101dd876
commit 1af8f56e89
11 files changed
+194 -152

No files matched your search

+10 -6
View File
@@ -204,14 +204,18 @@ impl<T: 'static, S: Storage<T>> CopyValue<T, S> {
}
}
impl<T: 'static, S: Storage<T>> Readable<T> for CopyValue<T, S> {
impl<T: 'static, S: Storage<T>> Readable for CopyValue<T, S> {
type Target = T;
type Ref<R: ?Sized + 'static> = S::Ref<R>;
fn map_ref<I, U: ?Sized, F: FnOnce(&I) -> &U>(ref_: Self::Ref<I>, f: F) -> Self::Ref<U> {
fn map_ref<I: ?Sized, U: ?Sized, F: FnOnce(&I) -> &U>(
ref_: Self::Ref<I>,
f: F,
) -> Self::Ref<U> {
S::map(ref_, f)
}
fn try_map_ref<I, U: ?Sized, F: FnOnce(&I) -> Option<&U>>(
fn try_map_ref<I: ?Sized, U: ?Sized, F: FnOnce(&I) -> Option<&U>>(
ref_: Self::Ref<I>,
f: F,
) -> Option<Self::Ref<U>> {
@@ -227,17 +231,17 @@ impl<T: 'static, S: Storage<T>> Readable<T> for CopyValue<T, S> {
}
}
impl<T: 'static, S: Storage<T>> Writable<T> for CopyValue<T, S> {
impl<T: 'static, S: Storage<T>> Writable for CopyValue<T, S> {
type Mut<R: ?Sized + 'static> = S::Mut<R>;
fn map_mut<I, U: ?Sized, F: FnOnce(&mut I) -> &mut U>(
fn map_mut<I: ?Sized, U: ?Sized, F: FnOnce(&mut I) -> &mut U>(
mut_: Self::Mut<I>,
f: F,
) -> Self::Mut<U> {
S::map_mut(mut_, f)
}
fn try_map_mut<I, U: ?Sized, F: FnOnce(&mut I) -> Option<&mut U>>(
fn try_map_mut<I: ?Sized, U: ?Sized, F: FnOnce(&mut I) -> Option<&mut U>>(
mut_: Self::Mut<I>,
f: F,
) -> Option<Self::Mut<U>> {