ladata/list/stack/
data.rs1use super::{Stack, Storage};
7use crate::all::{DataCollection, LadataResult as Result};
8
9pub trait DataStack: DataCollection {
11 fn stack_pop(&mut self) -> Result<<Self as DataCollection>::Element>;
13 fn stack_push(&mut self, element: <Self as DataCollection>::Element) -> Result<()>;
15}
16
17impl<T, S: Storage, const CAP: usize> DataCollection for Stack<T, S, CAP> {
18 type Element = T;
19
20 fn collection_is_empty(&self) -> Option<bool> {
21 Some(self.is_empty())
22 }
23 fn collection_is_full(&self) -> Option<bool> {
24 Some(self.is_full())
25 }
26 fn collection_capacity(&self) -> usize {
27 CAP
28 }
29 fn collection_len(&self) -> usize {
30 self.len()
31 }
32}