This commit is contained in:
Svyatoslav Nikolsky
2017-04-28 13:34:58 +03:00
parent 51c42b653c
commit e14e3e055a
10 changed files with 183 additions and 11 deletions

View File

@ -12,6 +12,13 @@ pub struct StackWithLimit<T> where T: Clone {
}
impl<T> StackWithLimit<T> where T: Clone {
pub fn with_data(data: Vec<T>, limit: usize) -> Self {
StackWithLimit {
values: data.into_iter().collect(),
limit: limit,
}
}
pub fn with_limit(limit: usize) -> Self {
StackWithLimit {
values: VecDeque::new(),