pub enum MaterialDataReference<'a> {
Direct(&'a MaterialData),
Global(Arc<RwLock<MaterialData>>),
}Expand description
A wrapper for MaterialData references.
This is neccessary for the global Material implementation.
Variants§
Direct(&'a MaterialData)
A normal Reference to a MaterialData of an unnamed/unshared Material.
Global(Arc<RwLock<MaterialData>>)
A Global Reference to a MaterialData of a named/shared Material via a Arc<RwLock<T>>.
Implementations§
Source§impl<'a> MaterialDataReference<'a>
impl<'a> MaterialDataReference<'a>
Sourcepub fn same_material_data(&self, other: &MaterialDataReference<'_>) -> bool
pub fn same_material_data(&self, other: &MaterialDataReference<'_>) -> bool
Check if the two referenced MaterialData structs describe the same appearance.
If one of the MaterialDatas is the Global and it is poisoned,
then we replace the data from the Direct with the other one and return true.
Trait Implementations§
Source§impl<'a> Debug for MaterialDataReference<'a>
impl<'a> Debug for MaterialDataReference<'a>
Source§impl<'a> From<&'a MaterialData> for MaterialDataReference<'a>
impl<'a> From<&'a MaterialData> for MaterialDataReference<'a>
Source§fn from(value: &'a MaterialData) -> Self
fn from(value: &'a MaterialData) -> Self
Converts to this type from the input type.
Source§impl<'a> From<Arc<RwLock<MaterialData>>> for MaterialDataReference<'a>
impl<'a> From<Arc<RwLock<MaterialData>>> for MaterialDataReference<'a>
Source§impl<'a> PartialEq for MaterialDataReference<'a>
impl<'a> PartialEq for MaterialDataReference<'a>
Source§impl<'a> TryFrom<MaterialDataReference<'a>> for MaterialData
impl<'a> TryFrom<MaterialDataReference<'a>> for MaterialData
Source§type Error = PoisonError<ErroredRead<Arc<RwLock<MaterialData>>>>
type Error = PoisonError<ErroredRead<Arc<RwLock<MaterialData>>>>
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl<'a> Freeze for MaterialDataReference<'a>
impl<'a> RefUnwindSafe for MaterialDataReference<'a>
impl<'a> Send for MaterialDataReference<'a>
impl<'a> Sync for MaterialDataReference<'a>
impl<'a> Unpin for MaterialDataReference<'a>
impl<'a> UnwindSafe for MaterialDataReference<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.