Trait atk::prelude::RelationSetExt
source · [−]pub trait RelationSetExt: 'static {
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
Required Methods
fn add_relation_by_type(
&self,
relationship: RelationType,
target: &impl IsA<Object>
)
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
fn contains(&self, relationship: RelationType) -> bool
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
fn contains_target(
&self,
relationship: RelationType,
target: &impl IsA<Object>
) -> bool
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
fn n_relations(&self) -> i32
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.
fn relation_by_type(&self, relationship: RelationType) -> Option<Relation>
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.