1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
use std::ops::Deref;
use serde::Deserialize;
use crate::{CompTag, BYTE_ARRAY_TAG, INT_ARRAY_TAG, LONG_ARRAY_TAG};
#[derive(Deserialize, Debug, Clone, PartialEq)]
pub struct ByteArray {
tag: CompTag<BYTE_ARRAY_TAG>,
data: Vec<i8>,
}
impl Deref for ByteArray {
type Target = Vec<i8>;
fn deref(&self) -> &Self::Target {
&self.data
}
}
#[derive(Deserialize, Debug, Clone, PartialEq)]
pub struct IntArray {
tag: CompTag<INT_ARRAY_TAG>,
data: Vec<i32>,
}
impl Deref for IntArray {
type Target = Vec<i32>;
fn deref(&self) -> &Self::Target {
&self.data
}
}
#[derive(Deserialize, Debug, Clone, PartialEq)]
pub struct LongArray {
tag: CompTag<LONG_ARRAY_TAG>,
data: Vec<i64>,
}
impl LongArray {
pub fn new(data: Vec<i64>) -> Self {
Self {
tag: CompTag::<LONG_ARRAY_TAG>,
data,
}
}
}
impl Deref for LongArray {
type Target = Vec<i64>;
fn deref(&self) -> &Self::Target {
&self.data
}
}