Skip to main content

Ref

Struct Ref 

Source
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>

Source

pub fn upcast<U: ObjectType>(self) -> Ref<U>
where T: Upcast<U>,

Converts the handle to a handle of a base class.

Source

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).

Source

pub fn cast<U: ObjectType>(&self) -> Option<Ref<U>>

Returns a handle of class U if the object is a U.

Source

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.

Source

pub fn is<U: ObjectType>(&self) -> bool

Whether the object is of class U or a class derived from it.

Source

pub fn downgrade(&self) -> WeakRef<T>

Creates a weak reference to the object.

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: ObjectType> Debug for Ref<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: ObjectType> Deref for Ref<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<T: ObjectType> Eq for Ref<T>

Source§

impl From<&Ref<Animation>> for Rc<dyn IAnimation>

Source§

fn from(value: &Ref<Animation>) -> Self

Converts to this type from the input type.
Source§

impl From<&Ref<CroppedBitmap>> for Rc<dyn IImage>

Source§

fn from(value: &Ref<CroppedBitmap>) -> Self

Converts to this type from the input type.
Source§

impl From<&Ref<DrawingImage>> for Rc<dyn IImage>

Source§

fn from(value: &Ref<DrawingImage>) -> Self

Converts to this type from the input type.
Source§

impl From<&Ref<StyleBase>> for Rc<dyn IResourceProvider>

Source§

fn from(value: &Ref<StyleBase>) -> Self

Converts to this type from the input type.
Source§

impl From<&Ref<Styles>> for Rc<dyn IResourceProvider>

Source§

fn from(value: &Ref<Styles>) -> Self

Converts to this type from the input type.
Source§

impl From<&Ref<Styles>> for Rc<dyn IStyle>

Source§

fn from(value: &Ref<Styles>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<TransitionBase>> From<&Ref<T>> for Rc<dyn ITransition>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for ResourceHostRef

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<ResourceDictionary>> From<&Ref<T>> for Rc<dyn IThemeVariantProvider>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<ResourceProvider>> From<&Ref<T>> for Rc<dyn IResourceProvider>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Effect>> From<&Ref<T>> for Rc<dyn IEffect>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Brush>> From<&Ref<T>> for Rc<dyn IBrush>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<DashStyle>> From<&Ref<T>> for Rc<dyn IDashStyle>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Pen>> From<&Ref<T>> for Rc<dyn IPen>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Transform>> From<&Ref<T>> for Rc<dyn ITransform>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<ExperimentalAcrylicMaterial>> From<&Ref<T>> for Rc<dyn IExperimentalAcrylicMaterial>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for StyleHostRef

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyleBase>> From<&Ref<T>> for Rc<dyn IStyle>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for Rc<dyn INamed>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<&Ref<T>> for Rc<dyn ISupportInitialize>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<U>, U: ObjectType> From<&Ref<T>> for Nullable<U>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<U>, U: ObjectType> From<&Ref<T>> for ElementRef<U>

Source§

fn from(value: &Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref<Animation>> for Rc<dyn IAnimation>

Source§

fn from(value: Ref<Animation>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref<CroppedBitmap>> for Rc<dyn IImage>

Source§

fn from(value: Ref<CroppedBitmap>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref<DrawingImage>> for Rc<dyn IImage>

Source§

fn from(value: Ref<DrawingImage>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref<StyleBase>> for Rc<dyn IAddChild<BoxedValue>>

Source§

fn from(value: Ref<StyleBase>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref<StyleBase>> for Rc<dyn IResourceProvider>

Source§

fn from(value: Ref<StyleBase>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref<Styles>> for Rc<dyn IStyle>

Source§

fn from(value: Ref<Styles>) -> Self

Converts to this type from the input type.
Source§

impl From<Ref<Styles>> for Rc<dyn IResourceProvider>

Source§

fn from(value: Ref<Styles>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<TransitionBase>> From<Ref<T>> for Rc<dyn ITransition>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for ResourceHostRef

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<ResourceDictionary>> From<Ref<T>> for Rc<dyn IThemeVariantProvider>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<ResourceDictionary>> From<Ref<T>> for Rc<dyn IResourceDictionary>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<ResourceProvider>> From<Ref<T>> for Rc<dyn IResourceProvider>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Effect>> From<Ref<T>> for Rc<dyn IEffect>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Brush>> From<Ref<T>> for Rc<dyn IBrush>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<DashStyle>> From<Ref<T>> for Rc<dyn IDashStyle>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<GradientStop>> From<Ref<T>> for Rc<dyn IGradientStop>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Pen>> From<Ref<T>> for Rc<dyn IPen>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<Transform>> From<Ref<T>> for Rc<dyn ITransform>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<ExperimentalAcrylicMaterial>> From<Ref<T>> for Rc<dyn IExperimentalAcrylicMaterial>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for StyleHostRef

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyleBase>> From<Ref<T>> for Rc<dyn IStyle>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for Rc<dyn INamed>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<StyledElement>> From<Ref<T>> for Rc<dyn ISupportInitialize>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectType + Upcast<U>, U: ObjectType> From<Ref<T>> for Nullable<U>

Source§

fn from(value: Ref<T>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Ref<Drawing>> for DrawingCollection

Source§

fn from_iter<I: IntoIterator<Item = Ref<Drawing>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Ref<Geometry>> for GeometryCollection

Source§

fn from_iter<I: IntoIterator<Item = Ref<Geometry>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Ref<GradientStop>> for GradientStops

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn from_iter<I: IntoIterator<Item = Ref<Transform>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: ObjectType> Hash for Ref<T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: ObjectType + Upcast<U>, U: ObjectType> IntoRef<U> for Ref<T>

Source§

fn into_ref(self) -> Ref<U>

Source§

impl<T: ObjectType + Upcast<U>, U: ObjectType> IntoRef<U> for &Ref<T>

Source§

fn into_ref(self) -> Ref<U>

Source§

impl<T: ObjectType, U: ObjectType> PartialEq<Ref<U>> for Ref<T>

Source§

fn eq(&self, other: &Ref<U>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: ObjectType> WeakEventSender for Ref<T>

Source§

type Weak = WeakRef<T>

The weak form of the handle.
Source§

fn downgrade_sender(&self) -> WeakRef<T>

Source§

fn upgrade_sender(weak: &WeakRef<T>) -> Option<Self>

Source§

fn sender_address(&self) -> usize

The address of the object the handle refers to.

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>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ResourceKeyObject for T
where T: Eq + Hash + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn dyn_eq(&self, other: &(dyn ResourceKeyObject + 'static)) -> bool

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Source§

fn key_type_name(&self) -> &'static str

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.