Trait atk::prelude::RelationSetExt [−][src]
pub trait RelationSetExt: 'static {
fn add<P: IsA<Relation>>(&self, relation: &P);
fn add_relation_by_type<P: IsA<Object>>(
&self,
relationship: RelationType,
target: &P
);
fn contains(&self, relationship: RelationType) -> bool;
fn contains_target<P: IsA<Object>>(
&self,
relationship: RelationType,
target: &P
) -> bool;
fn n_relations(&self) -> i32;
fn relation(&self, i: i32) -> Option<Relation>;
fn relation_by_type(&self, relationship: RelationType) -> Option<Relation>;
fn remove<P: IsA<Relation>>(&self, relation: &P);
}Expand description
Required methods
fn add_relation_by_type<P: IsA<Object>>(
&self,
relationship: RelationType,
target: &P
)
fn add_relation_by_type<P: IsA<Object>>(
&self,
relationship: RelationType,
target: &P
)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) -> boolDetermines 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<P: IsA<Object>>(
&self,
relationship: RelationType,
target: &P
) -> bool
fn contains_target<P: IsA<Object>>(
&self,
relationship: RelationType,
target: &P
) -> boolDetermines 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) -> i32Determines 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.