Rename from ReReference to Reference (#2099)

This commit is contained in:
Dongjia "toka" Zhang 2024-04-24 15:06:33 +02:00 committed by GitHub
parent 1e8667a9f9
commit c622a28eba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -538,13 +538,13 @@ where
} }
} }
/// Structs that has `ReReference ` /// Structs that has `Reference `
/// You should use this when you want to avoid specifying types using `match_name_type_mut` /// You should use this when you want to avoid specifying types using `match_name_type_mut`
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub trait Referenceable: Named { pub trait Referenceable: Named {
/// Return the `ReReference ` /// Return the `Reference `
fn type_ref(&self) -> ReReference<Self> { fn type_ref(&self) -> Reference<Self> {
ReReference { Reference {
name: Named::name(self).clone(), name: Named::name(self).clone(),
phantom: PhantomData, phantom: PhantomData,
} }
@ -557,19 +557,19 @@ impl<N> Referenceable for N where N: Named {}
/// Empty object with the type T /// Empty object with the type T
#[derive(Debug)] #[derive(Debug)]
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub struct ReReference<T: ?Sized> { pub struct Reference<T: ?Sized> {
name: Cow<'static, str>, name: Cow<'static, str>,
phantom: PhantomData<T>, phantom: PhantomData<T>,
} }
/// Search using `ReReference ` /// Search using `Reference `
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub trait MatchNameRef { pub trait MatchNameRef {
/// Search using name and `ReReference ` /// Search using name and `Reference `
fn match_by_ref<T>(&self, rf: ReReference<T>) -> Option<&T>; fn match_by_ref<T>(&self, rf: Reference<T>) -> Option<&T>;
/// Search using name and `ReReference ` /// Search using name and `Reference `
fn match_by_ref_mut<T>(&mut self, rf: ReReference<T>) -> Option<&mut T>; fn match_by_ref_mut<T>(&mut self, rf: Reference<T>) -> Option<&mut T>;
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
@ -577,11 +577,11 @@ impl<M> MatchNameRef for M
where where
M: MatchName, M: MatchName,
{ {
fn match_by_ref<T>(&self, rf: ReReference<T>) -> Option<&T> { fn match_by_ref<T>(&self, rf: Reference<T>) -> Option<&T> {
self.match_name::<T>(&rf.name) self.match_name::<T>(&rf.name)
} }
fn match_by_ref_mut<T>(&mut self, rf: ReReference<T>) -> Option<&mut T> { fn match_by_ref_mut<T>(&mut self, rf: Reference<T>) -> Option<&mut T> {
self.match_name_mut::<T>(&rf.name) self.match_name_mut::<T>(&rf.name)
} }
} }