forked from extern/nushell
Remove need for impl Clone on from_bson_bytes_to_value
This commit is contained in:
parent
a0f0372839
commit
9814eeae30
@ -94,17 +94,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> + std::clone::Clone,
|
tag: impl Into<Tag>,
|
||||||
) -> bson::DecoderResult<Tagged<Value>> {
|
) -> bson::DecoderResult<Tagged<Value>> {
|
||||||
let mut out = 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) {
|
||||||
out.push(convert_bson_value_to_nu_value(
|
docs.push(Bson::Document(v));
|
||||||
&Bson::Document(v),
|
|
||||||
tag.clone(),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
Ok(Value::List(out).tagged(tag))
|
Ok(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> {
|
||||||
@ -117,7 +114,7 @@ fn from_bson(args: CommandArgs, registry: &CommandRegistry) -> Result<OutputStre
|
|||||||
|
|
||||||
for value in values {
|
for value in values {
|
||||||
let value_tag = value.tag();
|
let value_tag = value.tag();
|
||||||
latest_tag = Some(value_tag);
|
let latest_tag = Some(value_tag);
|
||||||
match value.item {
|
match value.item {
|
||||||
Value::Binary(vb) =>
|
Value::Binary(vb) =>
|
||||||
match from_bson_bytes_to_value(vb, span) {
|
match from_bson_bytes_to_value(vb, span) {
|
||||||
|
Loading…
Reference in New Issue
Block a user