aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAria <me@aria.rip>2023-11-30 13:05:19 +0000
committerAria <me@aria.rip>2023-11-30 13:05:19 +0000
commit9d5b2b6f86525c3df26cbe729b14fed1907a152f (patch)
treead437e405611519d72d5fc79a9dde4430487faa9
parent29c26246fd9341e832d2c6496f93f7f0f5a2e666 (diff)
fix(library): dev dependencies instead of real dependencies
-rw-r--r--src/crates/library/Cargo.toml2
-rw-r--r--src/crates/library/src/traits.rs17
2 files changed, 15 insertions, 4 deletions
diff --git a/src/crates/library/Cargo.toml b/src/crates/library/Cargo.toml
index 5231ed9..afcd90d 100644
--- a/src/crates/library/Cargo.toml
+++ b/src/crates/library/Cargo.toml
@@ -5,6 +5,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-[dependencies]
+[dev-dependencies]
im = "10.2.0"
proptest = "1.0.0" \ No newline at end of file
diff --git a/src/crates/library/src/traits.rs b/src/crates/library/src/traits.rs
index a33f3d9..cf94fd4 100644
--- a/src/crates/library/src/traits.rs
+++ b/src/crates/library/src/traits.rs
@@ -1,12 +1,23 @@
//! Common traits for primrose container types
-pub trait Container<T> {
+pub trait Container<T>: Default {
+ /// Get the current number of elements
fn len(&mut self) -> usize;
- fn contains(&mut self, x: &T) -> bool;
+
+ /// Check if the container is empty
fn is_empty(&mut self) -> bool;
+
+ /// Check if the specified item is in the container
+ fn contains(&mut self, x: &T) -> bool;
+
+ /// Insert the given item
fn insert(&mut self, elt: T);
+
+ /// Remove the first occurence of the given item
+ fn remove(&mut self, elt: T) -> Option<T>;
+
+ /// Remove all elements from the container
fn clear(&mut self);
- fn remove(&mut self, elt: T) -> Option<T>; // remove first occurance
}
pub trait Stack<T> {