pub struct Ref<T: ObjectType> { /* private fields */ }Expand description
A strong reference to an object of class T or a class derived from it.
Cloning the handle shares the object. Equality and hashing are by object identity.
Implementations§
Source§impl<T: ObjectType> Ref<T>
impl<T: ObjectType> Ref<T>
Sourcepub fn upcast<U: ObjectType>(self) -> Ref<U>where
T: Upcast<U>,
pub fn upcast<U: ObjectType>(self) -> Ref<U>where
T: Upcast<U>,
Converts the handle to a handle of a base class.
Sourcepub fn upcast_ref<U: ObjectType>(&self) -> &Ref<U>where
T: Upcast<U>,
pub fn upcast_ref<U: ObjectType>(&self) -> &Ref<U>where
T: Upcast<U>,
Borrows the handle as a handle of a base class, without a copy of the
handle (the borrowing form of upcast).
Sourcepub fn cast<U: ObjectType>(&self) -> Option<Ref<U>>
pub fn cast<U: ObjectType>(&self) -> Option<Ref<U>>
Returns a handle of class U if the object is a U.
Sourcepub fn downcast<U: ObjectType>(self) -> Result<Ref<U>, Self>
pub fn downcast<U: ObjectType>(self) -> Result<Ref<U>, Self>
Converts the handle to class U if the object is a U, otherwise
returns the handle unchanged.
Sourcepub fn is<U: ObjectType>(&self) -> bool
pub fn is<U: ObjectType>(&self) -> bool
Whether the object is of class U or a class derived from it.
Sourcepub fn ptr_eq<U: ObjectType>(&self, other: &Ref<U>) -> bool
pub fn ptr_eq<U: ObjectType>(&self, other: &Ref<U>) -> bool
Whether two handles refer to the same object.
Trait Implementations§
Source§impl<T: ObjectType> Clone for Ref<T>
impl<T: ObjectType> Clone for Ref<T>
Source§impl<T: ObjectType> Debug for Ref<T>
impl<T: ObjectType> Debug for Ref<T>
Source§impl<T: ObjectType> Deref for Ref<T>
impl<T: ObjectType> Deref for Ref<T>
impl<T: ObjectType> Eq for Ref<T>
Source§impl From<&Ref<CroppedBitmap>> for Rc<dyn IImage>
impl From<&Ref<CroppedBitmap>> for Rc<dyn IImage>
Source§fn from(value: &Ref<CroppedBitmap>) -> Self
fn from(value: &Ref<CroppedBitmap>) -> Self
Converts to this type from the input type.
Source§impl From<&Ref<DrawingImage>> for Rc<dyn IImage>
impl From<&Ref<DrawingImage>> for Rc<dyn IImage>
Source§fn from(value: &Ref<DrawingImage>) -> Self
fn from(value: &Ref<DrawingImage>) -> Self
Converts to this type from the input type.
Source§impl<T: ObjectType + Upcast<TransitionBase>> From<&Ref<T>> for Rc<dyn ITransition>
impl<T: ObjectType + Upcast<TransitionBase>> From<&Ref<T>> for Rc<dyn ITransition>
Source§impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for ResourceHostRef
impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for ResourceHostRef
Source§impl<T: ObjectType + Upcast<ResourceDictionary>> From<&Ref<T>> for Rc<dyn IThemeVariantProvider>
impl<T: ObjectType + Upcast<ResourceDictionary>> From<&Ref<T>> for Rc<dyn IThemeVariantProvider>
Source§impl<T: ObjectType + Upcast<ResourceProvider>> From<&Ref<T>> for Rc<dyn IResourceProvider>
impl<T: ObjectType + Upcast<ResourceProvider>> From<&Ref<T>> for Rc<dyn IResourceProvider>
Source§impl<T: ObjectType + Upcast<DashStyle>> From<&Ref<T>> for Rc<dyn IDashStyle>
impl<T: ObjectType + Upcast<DashStyle>> From<&Ref<T>> for Rc<dyn IDashStyle>
Source§impl<T: ObjectType + Upcast<Transform>> From<&Ref<T>> for Rc<dyn ITransform>
impl<T: ObjectType + Upcast<Transform>> From<&Ref<T>> for Rc<dyn ITransform>
Source§impl<T: ObjectType + Upcast<ExperimentalAcrylicMaterial>> From<&Ref<T>> for Rc<dyn IExperimentalAcrylicMaterial>
impl<T: ObjectType + Upcast<ExperimentalAcrylicMaterial>> From<&Ref<T>> for Rc<dyn IExperimentalAcrylicMaterial>
Source§impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for StyleHostRef
impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for StyleHostRef
Source§impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for Rc<dyn INamed>
impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for Rc<dyn INamed>
Source§impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for Rc<dyn ISupportInitialize>
impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for Rc<dyn ISupportInitialize>
Source§impl<T: ObjectType + Upcast<U>, U: ObjectType> From<&Ref<T>> for Nullable<U>
impl<T: ObjectType + Upcast<U>, U: ObjectType> From<&Ref<T>> for Nullable<U>
Source§impl<T: ObjectType + Upcast<U>, U: ObjectType> From<&Ref<T>> for ElementRef<U>
impl<T: ObjectType + Upcast<U>, U: ObjectType> From<&Ref<T>> for ElementRef<U>
Source§impl From<Ref<CroppedBitmap>> for Rc<dyn IImage>
impl From<Ref<CroppedBitmap>> for Rc<dyn IImage>
Source§fn from(value: Ref<CroppedBitmap>) -> Self
fn from(value: Ref<CroppedBitmap>) -> Self
Converts to this type from the input type.
Source§impl From<Ref<DrawingImage>> for Rc<dyn IImage>
impl From<Ref<DrawingImage>> for Rc<dyn IImage>
Source§fn from(value: Ref<DrawingImage>) -> Self
fn from(value: Ref<DrawingImage>) -> Self
Converts to this type from the input type.
Source§impl<T: ObjectType + Upcast<TransitionBase>> From<Ref<T>> for Rc<dyn ITransition>
impl<T: ObjectType + Upcast<TransitionBase>> From<Ref<T>> for Rc<dyn ITransition>
Source§impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for ResourceHostRef
impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for ResourceHostRef
Source§impl<T: ObjectType + Upcast<ResourceDictionary>> From<Ref<T>> for Rc<dyn IThemeVariantProvider>
impl<T: ObjectType + Upcast<ResourceDictionary>> From<Ref<T>> for Rc<dyn IThemeVariantProvider>
Source§impl<T: ObjectType + Upcast<ResourceDictionary>> From<Ref<T>> for Rc<dyn IResourceDictionary>
impl<T: ObjectType + Upcast<ResourceDictionary>> From<Ref<T>> for Rc<dyn IResourceDictionary>
Source§impl<T: ObjectType + Upcast<ResourceProvider>> From<Ref<T>> for Rc<dyn IResourceProvider>
impl<T: ObjectType + Upcast<ResourceProvider>> From<Ref<T>> for Rc<dyn IResourceProvider>
Source§impl<T: ObjectType + Upcast<DashStyle>> From<Ref<T>> for Rc<dyn IDashStyle>
impl<T: ObjectType + Upcast<DashStyle>> From<Ref<T>> for Rc<dyn IDashStyle>
Source§impl<T: ObjectType + Upcast<GradientStop>> From<Ref<T>> for Rc<dyn IGradientStop>
impl<T: ObjectType + Upcast<GradientStop>> From<Ref<T>> for Rc<dyn IGradientStop>
Source§impl<T: ObjectType + Upcast<Transform>> From<Ref<T>> for Rc<dyn ITransform>
impl<T: ObjectType + Upcast<Transform>> From<Ref<T>> for Rc<dyn ITransform>
Source§impl<T: ObjectType + Upcast<ExperimentalAcrylicMaterial>> From<Ref<T>> for Rc<dyn IExperimentalAcrylicMaterial>
impl<T: ObjectType + Upcast<ExperimentalAcrylicMaterial>> From<Ref<T>> for Rc<dyn IExperimentalAcrylicMaterial>
Source§impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for StyleHostRef
impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for StyleHostRef
Source§impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for Rc<dyn INamed>
impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for Rc<dyn INamed>
Source§impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for Rc<dyn ISupportInitialize>
impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for Rc<dyn ISupportInitialize>
Source§impl<T: ObjectType + Upcast<U>, U: ObjectType> From<Ref<T>> for Nullable<U>
impl<T: ObjectType + Upcast<U>, U: ObjectType> From<Ref<T>> for Nullable<U>
Source§impl FromIterator<Ref<Drawing>> for DrawingCollection
impl FromIterator<Ref<Drawing>> for DrawingCollection
Source§impl FromIterator<Ref<Geometry>> for GeometryCollection
impl FromIterator<Ref<Geometry>> for GeometryCollection
Source§impl FromIterator<Ref<GradientStop>> for GradientStops
impl FromIterator<Ref<GradientStop>> for GradientStops
Source§fn from_iter<I: IntoIterator<Item = Ref<GradientStop>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Ref<GradientStop>>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl FromIterator<Ref<PathFigure>> for PathFigures
impl FromIterator<Ref<PathFigure>> for PathFigures
Source§fn from_iter<I: IntoIterator<Item = Ref<PathFigure>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Ref<PathFigure>>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl FromIterator<Ref<PathSegment>> for PathSegments
impl FromIterator<Ref<PathSegment>> for PathSegments
Source§fn from_iter<I: IntoIterator<Item = Ref<PathSegment>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Ref<PathSegment>>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl FromIterator<Ref<TextDecoration>> for TextDecorationCollection
impl FromIterator<Ref<TextDecoration>> for TextDecorationCollection
Source§fn from_iter<I: IntoIterator<Item = Ref<TextDecoration>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Ref<TextDecoration>>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl FromIterator<Ref<Transform>> for Transforms
impl FromIterator<Ref<Transform>> for Transforms
Source§impl<T: ObjectType> Hash for Ref<T>
impl<T: ObjectType> Hash for Ref<T>
Source§impl<T: ObjectType + Upcast<U>, U: ObjectType> IntoRef<U> for Ref<T>
impl<T: ObjectType + Upcast<U>, U: ObjectType> IntoRef<U> for Ref<T>
Source§impl<T: ObjectType + Upcast<U>, U: ObjectType> IntoRef<U> for &Ref<T>
impl<T: ObjectType + Upcast<U>, U: ObjectType> IntoRef<U> for &Ref<T>
Source§impl<T: ObjectType, U: ObjectType> PartialEq<Ref<U>> for Ref<T>
impl<T: ObjectType, U: ObjectType> PartialEq<Ref<U>> for Ref<T>
Source§impl<T: ObjectType> WeakEventSender for Ref<T>
impl<T: ObjectType> WeakEventSender for Ref<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Ref<T>
impl<T> !Send for Ref<T>
impl<T> !Sync for Ref<T>
impl<T> !UnwindSafe for Ref<T>
impl<T> Freeze for Ref<T>where
PhantomData<T>: Freeze,
impl<T> Unpin for Ref<T>where
PhantomData<T>: Unpin,
impl<T> UnsafeUnpin for Ref<T>where
PhantomData<T>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more