Skip to main content

CompositionObject

Struct CompositionObject 

Source
pub struct CompositionObject { /* private fields */ }
Expand description

The part every composition object embeds: what upstream’s abstract CompositionObject holds.

A class “derives” from CompositionObject by embedding this value, implementing ICompositorSerializable through it, and forwarding the animation members to the functions of this module.

The server-side counterpart is known by id. Disposing the object disposes its counterpart with the next batch, which keeps it under its id while this object is alive: upstream the UI-thread object holds its server object, so jobs and animations that name it after the disposal still reach it, and the id cannot be reused meanwhile. When the object is dropped, its counterpart is disposed (if it was not) and released with a later batch: this stands in for the garbage collector, which reclaims a server object upstream once the UI-thread object is unreachable. A counterpart that was disposed out of band (a composition target) is kept and released the same way.

Implementations§

Source§

impl CompositionObject

Source

pub fn new(compositor: &Rc<Compositor>, server: Option<ServerObjectId>) -> Self

Source

pub fn implicit_animations(&self) -> Option<Rc<ImplicitAnimationCollection>>

The collection of implicit animations attached to this object.

Source

pub fn set_implicit_animations( &self, value: Option<Rc<ImplicitAnimationCollection>>, )

Source

pub fn implicit_animation( &self, property_name: &str, ) -> Option<Rc<dyn ICompositionAnimationBase>>

The implicit animation attached to a property of the object, if there is one (ImplicitAnimations?.TryGetValue(name) of the generated setters).

Source

pub fn compositor(&self) -> &Rc<Compositor>

Source

pub fn server(&self) -> Option<ServerObjectId>

The id of the server-side counterpart, if the object has one.

Source

pub fn required_server(&self) -> ServerObjectId

The id of the server-side counterpart. Panics if there is none.

Source

pub fn try_get_server(&self, c: &Compositor) -> Option<ServerObjectId>

ICompositorSerializable.TryGetServer. A disposed object has no counterpart any more, so its pending changes are not written.

Source

pub fn is_disposed(&self) -> bool

Source

pub fn pending_animations(&self) -> &PendingAnimations

Source

pub fn dispose(&self)

Source

pub fn register_for_serialization( &self, this: impl FnOnce() -> Option<Rc<dyn ICompositorSerializable>>, )

Queues the object for serialization. this yields the handle of the object that embeds this part.

Source

pub fn begin_serialize_changes(&self, c: &Compositor)

The head of ICompositorSerializable.SerializeChanges: the object may be registered again from now on.

Source

pub fn stop_animation(&self, property: &'static CompositionProperty)

StopAnimation: removes the animation of a property on the server. property is the composition property the class resolved from the property name. The server object is reached through a job of the next batch.

Trait Implementations§

Source§

impl Drop for CompositionObject

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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