Trait OrderedRelationshipSourceCollection
pub trait OrderedRelationshipSourceCollection: RelationshipSourceCollection {
// Required methods
fn insert(&mut self, index: usize, entity: Entity);
fn remove_at(&mut self, index: usize) -> Option<Entity>;
fn insert_stable(&mut self, index: usize, entity: Entity);
fn remove_at_stable(&mut self, index: usize) -> Option<Entity>;
fn sort(&mut self);
fn insert_sorted(&mut self, entity: Entity);
fn place_most_recent(&mut self, index: usize);
fn place(&mut self, entity: Entity, index: usize);
// Provided methods
fn push_front(&mut self, entity: Entity) { ... }
fn push_back(&mut self, entity: Entity) { ... }
fn pop_front(&mut self) -> Option<Entity> { ... }
fn pop_back(&mut self) -> Option<Entity> { ... }
}Expand description
This trait signals that a RelationshipSourceCollection is ordered.
Required Methods§
fn insert(&mut self, index: usize, entity: Entity)
fn insert(&mut self, index: usize, entity: Entity)
Inserts the entity at a specific index. If the index is too large, the entity will be added to the end of the collection.
fn remove_at(&mut self, index: usize) -> Option<Entity>
fn remove_at(&mut self, index: usize) -> Option<Entity>
Removes the entity at the specified index if it exists.
fn insert_stable(&mut self, index: usize, entity: Entity)
fn insert_stable(&mut self, index: usize, entity: Entity)
Inserts the entity at a specific index. This will never reorder other entities. If the index is too large, the entity will be added to the end of the collection.
fn remove_at_stable(&mut self, index: usize) -> Option<Entity>
fn remove_at_stable(&mut self, index: usize) -> Option<Entity>
Removes the entity at the specified index if it exists. This will never reorder other entities.
fn sort(&mut self)
fn sort(&mut self)
Sorts the source collection.
fn insert_sorted(&mut self, entity: Entity)
fn insert_sorted(&mut self, entity: Entity)
Inserts the entity at the proper place to maintain sorting.
fn place_most_recent(&mut self, index: usize)
fn place_most_recent(&mut self, index: usize)
This places the most recently added entity at the particular index.
Provided Methods§
fn push_front(&mut self, entity: Entity)
fn push_front(&mut self, entity: Entity)
Adds the entity at index 0.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.