mirror of
https://github.com/nushell/nushell
synced 2024-12-28 05:53:09 +00:00
delete the file row.rs in nu-protocol/value which has references to RowStream (#339)
This commit is contained in:
parent
50cbd16ec7
commit
4fd020ab7f
2 changed files with 0 additions and 56 deletions
|
@ -1,12 +1,10 @@
|
||||||
mod range;
|
mod range;
|
||||||
mod row;
|
|
||||||
mod stream;
|
mod stream;
|
||||||
mod unit;
|
mod unit;
|
||||||
|
|
||||||
use chrono::{DateTime, FixedOffset};
|
use chrono::{DateTime, FixedOffset};
|
||||||
use chrono_humanize::HumanTime;
|
use chrono_humanize::HumanTime;
|
||||||
pub use range::*;
|
pub use range::*;
|
||||||
pub use row::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
pub use stream::*;
|
pub use stream::*;
|
||||||
pub use unit::*;
|
pub use unit::*;
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
use std::{cell::RefCell, fmt::Debug, rc::Rc};
|
|
||||||
|
|
||||||
use crate::*;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct RowStream(Rc<RefCell<dyn Iterator<Item = Vec<Value>>>>);
|
|
||||||
|
|
||||||
impl RowStream {
|
|
||||||
pub fn into_string(self, headers: Vec<String>, config: &Config) -> String {
|
|
||||||
format!(
|
|
||||||
"[{}]\n[{}]",
|
|
||||||
headers
|
|
||||||
.iter()
|
|
||||||
.map(|x| x.to_string())
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
.join(", "),
|
|
||||||
self.map(|x: Vec<Value>| {
|
|
||||||
x.into_iter()
|
|
||||||
.map(|x| x.into_string(", ", config))
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
.join(", ")
|
|
||||||
})
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
.join("\n")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Debug for RowStream {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
f.debug_struct("ValueStream").finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Iterator for RowStream {
|
|
||||||
type Item = Vec<Value>;
|
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
|
||||||
{
|
|
||||||
let mut iter = self.0.borrow_mut();
|
|
||||||
iter.next()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait IntoRowStream {
|
|
||||||
fn into_row_stream(self) -> RowStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IntoRowStream for Vec<Vec<Value>> {
|
|
||||||
fn into_row_stream(self) -> RowStream {
|
|
||||||
RowStream(Rc::new(RefCell::new(self.into_iter())))
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue