mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-28 05:21:04 +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>>;
|
fn pop(&mut self, n: usize) -> Option<Vec<Self::Item>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
pub struct Stack<T> {
|
pub struct Stack<T>
|
||||||
|
where
|
||||||
|
T: Default,
|
||||||
|
{
|
||||||
inner: Vec<T>,
|
inner: Vec<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Stack<T> {
|
impl<T> Stack<T>
|
||||||
|
where
|
||||||
|
T: Default,
|
||||||
|
{
|
||||||
pub fn new() -> Self {
|
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;
|
type Item = T;
|
||||||
|
|
||||||
fn is_empty(&self) -> bool {
|
fn is_empty(&self) -> bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user