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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use crate::binary_parser_types::*;
use crate::symbol_table::SymbolContextError;
use bigdecimal::BigDecimal;
use chrono::{DateTime, FixedOffset};
use num_bigint::BigInt;
use std::collections::HashMap;
#[derive(Eq, PartialEq, Debug)]
pub enum IonParserError {
Unimplemented,
BadFormatLengthFound,
NullAnnotationFound,
SharedTableAndLocalTableDeclarationIntTheSameAnnotation,
SymbolIdNotDefined,
LocalTableWithoutInternalStruct,
SharedTableDefinitionWithoutName,
ErrorAddingSharedTableToContext(SymbolContextError),
ErrorAddingCreatingLocal(SymbolContextError),
LocalSymbolTableWithoutValidImport,
SymbolNotFoundInTable,
ListLengthWasTooShort,
NonUtf8String,
DidNotGetAListConsumingAListThisIsABug,
SymbolIdTooBig,
TableVersionTooBig,
DateValueTooBig,
ValueLenTooBig,
NotValidLengthFloat,
BinaryError(ParsingError),
DecimalExponentTooBig,
InvalidBoolLength(ValueLength),
InvalidDate(i32, u32, u32, u32, u32, u32, u32),
}
impl From<ParsingError> for IonParserError {
fn from(err: ParsingError) -> Self {
IonParserError::BinaryError(err)
}
}
#[derive(PartialEq, Debug, Clone)]
pub enum IonValue {
Null(NullIonValue),
Bool(bool),
Integer(i64),
BigInteger(BigInt),
Float32(f32),
Float64(f64),
Decimal(BigDecimal),
DateTime(DateTime<FixedOffset>),
String(String),
Symbol(String),
Clob(Vec<u8>),
Blob(Vec<u8>),
List(Vec<IonValue>),
SExpr(Vec<IonValue>),
Struct(HashMap<String, IonValue>),
Annotation(Vec<String>, Box<IonValue>),
}
impl Eq for IonValue {}
#[derive(PartialEq, Debug, Clone)]
pub enum NullIonValue {
Null,
Bool,
Integer,
BigInteger,
Float,
Decimal,
DateTime,
String,
Symbol,
Clob,
Blob,
List,
SExpr,
Struct,
Annotation,
}