1 use std::collections::HashMap; 2 #[derive(PartialEq, Clone, Debug)] 3 pub enum Amf0ValueType { 4 Number(f64), 5 Boolean(bool), 6 UTF8String(String), 7 Object(HashMap<String, Amf0ValueType>), 8 Null, 9 EcmaArray(HashMap<String, Amf0ValueType>), 10 LongUTF8String(String), 11 END, 12 } 13 14 // pub struct Amf0Object { 15 // pub key: String, 16 // pub value: Amf0ValueType, 17 // } 18 19 // impl Amf0Object { 20 // pub fn clone(self) -> Amf0Object { 21 // Amf0Object { 22 // key: self.key.clone(), 23 // value: self.value.clone(), 24 // } 25 // } 26 // } 27 28 // pub struct AmfObjectMap{ 29 // properties: HashMap<String,Amf0Object>, 30 31 // } 32 33 // impl AmfObjectMap { 34 // fn Clone(self) -> AmfObjectMap { 35 // self.properties.clone() 36 // } 37 // } 38 39 // pub struct UnOrderedMap { 40 // properties: Vec<Amf0Object>, 41 // } 42 43 // impl UnOrderedMap { 44 // pub fn new() -> UnOrderedMap { 45 // UnOrderedMap { 46 // properties: Vec::new(), 47 // } 48 // } 49 // pub fn insert(self, key: String, val: Amf0ValueType) -> Option<Amf0ValueType> { 50 // for i in &self.properties { 51 // if i.key == key { 52 // let tmpVal = i.value.clone(); 53 // i.value = val; 54 // return Some(tmpVal); 55 // } 56 // } 57 58 // let obj = Amf0Object { 59 // key: key, 60 // value: val, 61 // }; 62 // self.properties.push(obj); 63 64 // None 65 // } 66 // fn get_by_key(self, key: String) -> Option<Amf0ValueType> { 67 // for i in self.properties { 68 // if i.key == key { 69 // return Some(i.value); 70 // } 71 // } 72 // None 73 // } 74 75 // pub fn get(self, idx: usize) -> Amf0Object { 76 // self.properties[idx] 77 // } 78 79 // pub fn len(self) -> usize { 80 // self.properties.len() 81 // } 82 83 // pub fn Clone(self) -> UnOrderedMap { 84 // UnOrderedMap { 85 // properties: self.properties.clone(), 86 // } 87 // } 88 // } 89