mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-18 09:00:51 +00:00
feat(interface-types) Stack
supports Default
.
This commit is contained in:
parent
9d4c983206
commit
39a817817b
@ -8,18 +8,29 @@ pub trait Stackable {
|
||||
fn pop(&mut self, n: usize) -> Option<Vec<Self::Item>>;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Stack<T> {
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Stack<T>
|
||||
where
|
||||
T: Default,
|
||||
{
|
||||
inner: Vec<T>,
|
||||
}
|
||||
|
||||
impl<T> Stack<T> {
|
||||
impl<T> Stack<T>
|
||||
where
|
||||
T: Default,
|
||||
{
|
||||
pub fn new() -> Self {
|
||||
Self { inner: Vec::new() }
|
||||
Self {
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Stackable for Stack<T> {
|
||||
impl<T> Stackable for Stack<T>
|
||||
where
|
||||
T: Default,
|
||||
{
|
||||
type Item = T;
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
|
Loading…
x
Reference in New Issue
Block a user