Skip to main content

RelationSetExt

Trait RelationSetExt 

Source
pub trait RelationSetExt:
    IsA<RelationSet>
    + Sealed
    + 'static {
    // Provided methods
    fn add(&self, relation: &impl IsA<Relation>) { ... }
    fn add_relation_by_type(
        &self,
        relationship: RelationType,
        target: &impl IsA<Object>,
    ) { ... }
    fn contains(&self, relationship: RelationType) -> bool { ... }
    fn contains_target(
        &self,
        relationship: RelationType,
        target: &impl IsA<Object>,
    ) -> bool { ... }
    fn n_relations(&self) -> i32 { ... }
    fn relation(&self, i: i32) -> Option<Relation> { ... }
    fn relation_by_type(&self, relationship: RelationType) -> Option<Relation> { ... }
    fn remove(&self, relation: &impl IsA<Relation>) { ... }
}
Expand description

Trait containing all RelationSet methods.

§Implementors

RelationSet

Provided Methods§

Source

fn add(&self, relation: &impl IsA<Relation>)

Add a new relation to the current relation set if it is not already present. This function ref’s the AtkRelation so the caller of this function should unref it to ensure that it will be destroyed when the AtkRelationSet is destroyed.

§relation

an Relation

Source

fn add_relation_by_type( &self, relationship: RelationType, target: &impl IsA<Object>, )

Add a new relation of the specified type with the specified target to the current relation set if the relation set does not contain a relation of that type. If it is does contain a relation of that typea the target is added to the relation.

§relationship

an RelationType

§target

an Object

Source

fn contains(&self, relationship: RelationType) -> bool

Determines whether the relation set contains a relation that matches the specified type.

§relationship

an RelationType

§Returns

true if relationship is the relationship type of a relation in self, false otherwise

Source

fn contains_target( &self, relationship: RelationType, target: &impl IsA<Object>, ) -> bool

Determines whether the relation set contains a relation that matches the specified pair formed by type relationship and object target.

§relationship

an RelationType

§target

an Object

§Returns

true if self contains a relation with the relationship type relationship with an object target, false otherwise

Source

fn n_relations(&self) -> i32

Determines the number of relations in a relation set.

§Returns

an integer representing the number of relations in the set.

Source

fn relation(&self, i: i32) -> Option<Relation>

Determines the relation at the specified position in the relation set.

§i

a gint representing a position in the set, starting from 0.

§Returns

a Relation, which is the relation at position i in the set.

Source

fn relation_by_type(&self, relationship: RelationType) -> Option<Relation>

Finds a relation that matches the specified type.

§relationship

an RelationType

§Returns

an Relation, which is a relation matching the specified type.

Source

fn remove(&self, relation: &impl IsA<Relation>)

Removes a relation from the relation set. This function unref’s the Relation so it will be deleted unless there is another reference to it.

§relation

an Relation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§