nushell/crates/nu_plugin_to_bson/src/nu/mod.rs
Jonathan Turner 7e184b58b2
Fix warnings for Rust 1.51 (#3214)
* Fix warnings for Rust 1.51

* More fixes

* More fixes
2021-03-26 21:26:57 +13:00

26 lines
662 B
Rust

#[cfg(test)]
mod tests;
use crate::ToBson;
use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{ReturnValue, Signature, Value};
use nu_source::Tag;
impl Plugin for ToBson {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("to bson")
.desc("Convert table into .bson binary")
.filter())
}
fn filter(&mut self, input: Value) -> Result<Vec<ReturnValue>, ShellError> {
self.state.push(input);
Ok(vec![])
}
fn end_filter(&mut self) -> Result<Vec<ReturnValue>, ShellError> {
Ok(crate::to_bson::to_bson(self.state.clone(), Tag::unknown()))
}
}