Merge pull request #572 from nushell/bigint

Migrated numerics to BigInt/BigDecimal
This commit is contained in:
Yehuda Katz 2019-09-01 22:39:01 -07:00 committed by GitHub
commit 9773f8fbab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -186,13 +186,14 @@ impl std::io::Read for BytesReader {
pub fn from_bson_bytes_to_value( pub fn from_bson_bytes_to_value(
bytes: Vec<u8>, bytes: Vec<u8>,
tag: impl Into<Tag>, tag: impl Into<Tag>,
) -> bson::DecoderResult<Tagged<Value>> { ) -> Result<Tagged<Value>, ShellError> {
let mut docs = Vec::new(); let mut docs = Vec::new();
let mut b_reader = BytesReader::new(bytes); let mut b_reader = BytesReader::new(bytes);
while let Ok(v) = decode_document(&mut b_reader) { while let Ok(v) = decode_document(&mut b_reader) {
docs.push(Bson::Document(v)); docs.push(Bson::Document(v));
} }
Ok(convert_bson_value_to_nu_value(&Bson::Array(docs), tag).expect("FIXME: Don't commit like this"))
convert_bson_value_to_nu_value(&Bson::Array(docs), tag)
} }
fn from_bson(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream, ShellError> { fn from_bson(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStream, ShellError> {