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§
Sourcefn 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.
Sourcefn remove_at(&mut self, index: usize) -> Option<Entity>
fn remove_at(&mut self, index: usize) -> Option<Entity>
Removes the entity at the specified idnex if it exists.
Sourcefn 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.
Sourcefn 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 idnex if it exists. This will never reorder other entities.
Sourcefn insert_sorted(&mut self, entity: Entity)
fn insert_sorted(&mut self, entity: Entity)
Inserts the entity at the proper place to maintain sorting.
Sourcefn 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§
Sourcefn 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.