mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 09:54:41 -05:00
add Borrow implementation to make it easier to abstract over T and Guard<T>
This commit is contained in:
@@ -2,6 +2,7 @@ use crate::traits::Trigger;
|
||||
use core::fmt::Debug;
|
||||
use guardian::ArcRwLockReadGuardian;
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
fmt::Display,
|
||||
marker::PhantomData,
|
||||
ops::{Deref, DerefMut},
|
||||
@@ -34,6 +35,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, Inner> Borrow<T> for ReadGuard<T, Inner>
|
||||
where
|
||||
Inner: Deref<Target = T>,
|
||||
{
|
||||
fn borrow(&self) -> &T {
|
||||
self.deref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, Inner> PartialEq<T> for ReadGuard<T, Inner>
|
||||
where
|
||||
Inner: Deref<Target = T>,
|
||||
|
||||
Reference in New Issue
Block a user