Skip to content

Commit b8e8e82

Browse files
authored
Move the Ion value types to the types module (#543)
1 parent 33a8fb9 commit b8e8e82

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+194
-186
lines changed

src/binary/binary_writer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use crate::binary::raw_binary_writer::{RawBinaryWriter, RawBinaryWriterBuilder};
22
use crate::constants::v1_0::system_symbol_ids;
33
use crate::raw_symbol_token_ref::{AsRawSymbolTokenRef, RawSymbolTokenRef};
44
use crate::result::{illegal_operation, IonResult};
5-
use crate::types::decimal::Decimal;
6-
use crate::types::timestamp::Timestamp;
5+
use crate::types::Decimal;
76
use crate::types::SymbolId;
7+
use crate::types::Timestamp;
88
use crate::writer::IonWriter;
9-
use crate::{Int, IonType, SymbolTable};
9+
use crate::{types::Int, types::IonType, SymbolTable};
1010
use delegate::delegate;
1111
use std::io::Write;
1212

src/binary/decimal.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ use crate::{
1111
int::DecodedInt, raw_binary_writer::MAX_INLINE_LENGTH, var_int::VarInt, var_uint::VarUInt,
1212
},
1313
result::IonResult,
14-
types::{
15-
coefficient::{Coefficient, Sign},
16-
decimal::Decimal,
17-
integer::UInt,
18-
},
14+
types::{Coefficient, Decimal, Sign, UInt},
1915
IonError,
2016
};
2117

src/binary/int.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use std::mem;
22

33
use crate::data_source::IonDataSource;
44
use crate::result::{decoding_error, IonResult};
5-
use crate::types::coefficient;
6-
use crate::types::coefficient::Coefficient;
7-
use crate::Int;
5+
use crate::types;
6+
use crate::types::Coefficient;
7+
use crate::types::Int;
88
use num_bigint::{BigInt, Sign};
99
use num_traits::Zero;
1010
use std::io::Write;
@@ -196,7 +196,7 @@ impl From<DecodedInt> for Coefficient {
196196
is_negative,
197197
.. // ignore `size_in_bytes`
198198
} = int;
199-
use coefficient::Sign::{Negative, Positive};
199+
use types::Sign::{Negative, Positive};
200200
let sign = if is_negative { Negative } else { Positive };
201201
Coefficient::new(sign, value)
202202
}
@@ -206,7 +206,7 @@ impl From<DecodedInt> for Coefficient {
206206
mod tests {
207207
use super::*;
208208
use crate::result::IonResult;
209-
use crate::Int;
209+
use crate::types::Int;
210210
use std::io;
211211
use std::io::Cursor;
212212

src/binary/non_blocking/binary_buffer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use crate::binary::uint::DecodedUInt;
77
use crate::binary::var_int::VarInt;
88
use crate::binary::var_uint::VarUInt;
99
use crate::result::{decoding_error, incomplete_data_error, incomplete_data_error_raw};
10-
use crate::types::integer::UInt;
11-
use crate::{Int, IonResult, IonType};
10+
use crate::types::{Int, UInt};
11+
use crate::{IonResult, IonType};
1212
use num_bigint::{BigInt, BigUint, Sign};
1313
use std::io::Read;
1414
use std::mem;

src/binary/non_blocking/raw_binary_reader.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ use crate::binary::non_blocking::type_descriptor::{Header, TypeDescriptor};
55
use crate::binary::uint::DecodedUInt;
66
use crate::binary::var_uint::VarUInt;
77
use crate::binary::IonTypeCode;
8-
use crate::element::{Blob, Clob};
98
use crate::result::{
109
decoding_error, decoding_error_raw, illegal_operation, illegal_operation_raw,
1110
incomplete_data_error,
1211
};
13-
use crate::types::integer::IntAccess;
14-
use crate::types::string::Str;
12+
use crate::types::IntAccess;
13+
use crate::types::Str;
1514
use crate::types::SymbolId;
15+
use crate::types::{Blob, Clob};
1616
use crate::{
17-
raw_reader::BufferedRawReader, Decimal, Int, IonReader, IonResult, IonType, RawStreamItem,
18-
RawSymbolToken, Timestamp,
17+
raw_reader::BufferedRawReader, types::Decimal, Int, IonReader, IonResult, IonType,
18+
RawStreamItem, RawSymbolToken, Timestamp,
1919
};
2020
use bytes::{BigEndian, Buf, ByteOrder};
2121
use num_bigint::BigUint;

src/binary/raw_binary_writer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use crate::binary::uint::DecodedUInt;
1111
use crate::binary::var_uint::VarUInt;
1212
use crate::raw_symbol_token_ref::{AsRawSymbolTokenRef, RawSymbolTokenRef};
1313
use crate::result::{illegal_operation, IonResult};
14-
use crate::types::decimal::Decimal;
15-
use crate::types::timestamp::Timestamp;
14+
use crate::types::Decimal;
15+
use crate::types::Timestamp;
1616
use crate::types::{ContainerType, SymbolId};
1717
use crate::writer::IonWriter;
1818
use crate::{Int, IonType};
@@ -910,10 +910,10 @@ mod writer_tests {
910910
use rstest::*;
911911

912912
use super::*;
913-
use crate::element::{Blob, Clob};
914913
use crate::raw_symbol_token::{local_sid_token, RawSymbolToken};
915914
use crate::reader::{Reader, ReaderBuilder};
916-
use crate::symbol::Symbol;
915+
use crate::types::Symbol;
916+
use crate::types::{Blob, Clob};
917917
use crate::IonReader;
918918
use num_bigint::BigInt;
919919
use num_traits::Float;

src/binary/timestamp.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ use crate::{
1111
var_uint::VarUInt,
1212
},
1313
result::IonResult,
14-
types::{
15-
decimal::Decimal,
16-
timestamp::{Mantissa, Precision, Timestamp},
17-
},
14+
types::{Decimal, Mantissa, Precision, Timestamp},
1815
};
1916

2017
const MAX_TIMESTAMP_LENGTH: usize = 32;

src/binary/uint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::mem;
44

55
use crate::data_source::IonDataSource;
66
use crate::result::{decoding_error, IonResult};
7-
use crate::types::integer::{Int, UInt};
7+
use crate::types::{Int, UInt};
88

99
// This limit is used for stack-allocating buffer space to encode/decode UInts.
1010
const UINT_STACK_BUFFER_SIZE: usize = 16;

src/blocking_reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::raw_reader::BufferedRawReader;
88
use crate::result::IonResult;
99
use crate::stream_reader::IonReader;
1010
use crate::text::non_blocking::raw_text_reader::RawTextReader;
11-
use crate::types::timestamp::Timestamp;
11+
use crate::types::Timestamp;
1212
use crate::{Decimal, Int, IonError, IonType, Str};
1313

1414
pub type BlockingRawTextReader<T> = BlockingRawReader<RawTextReader<Vec<u8>>, T>;

src/element/builders.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ macro_rules! ion_struct {
348348
}};
349349
}
350350

351-
use crate::element::list::List;
352-
use crate::element::sexp::SExp;
351+
use crate::types::List;
352+
use crate::types::SExp;
353353
pub use ion_list;
354354
pub use ion_sexp;
355355
pub use ion_struct;

0 commit comments

Comments
 (0)