rust_dynamic/
pop.rs

1use crate::value::{Value};
2use crate::types::*;
3
4impl Value {
5    pub fn pop(&mut self) -> Option<Value> {
6        match self.dt {
7            LIST | RESULT => {
8                match &mut self.data {
9                    Val::List(ref mut v) => {
10                        return v.pop().clone();
11                    }
12                    _ => return None,
13                }
14            }
15            FIFO => {
16                match &mut self.data {
17                    Val::Queue(ref mut v) => {
18                        return v.pop().clone();
19                    }
20                    _ => return None,
21                }
22            }
23            _ => {
24                return None;
25            }
26        }
27    }
28}