diff --git a/Cargo.toml b/Cargo.toml index 58eec4b..89c7156 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ rust-version = "1.70" [dependencies] cfg-if = "1.0" -paste = "1.0.14" +paste = "1.0" serde = { version = "1.0", optional = true, features = ["derive"]} [dev-dependencies] diff --git a/src/impls/columns.rs b/src/impls/columns.rs index 618939d..e11c959 100644 --- a/src/impls/columns.rs +++ b/src/impls/columns.rs @@ -20,9 +20,33 @@ use crate::{CopyOnto, CopyRegion, Index, Region}; /// /// Copy a table-like structure: /// ``` +/// # use flatcontainer::impls::deduplicate::ConsecutiveOffsetPairs; +/// # use flatcontainer::{ColumnsRegion, CopyOnto, Region, StringRegion}; +/// let data = [ +/// vec![], +/// vec!["1"], +/// vec!["2", "3"], +/// vec!["4", "5", "6"], +/// vec!["7", "8"], +/// vec!["9"], +/// vec![], +/// ]; +/// +/// let mut r = ColumnsRegion::, _>::default(); +/// +/// let mut indices = Vec::with_capacity(data.len()); +/// +/// for row in &data { +/// let index = row.copy_onto(&mut r); +/// indices.push(index); +/// } +/// +/// for (&index, row) in indices.iter().zip(&data) { +/// assert!(row.iter().copied().eq(r.index(index).iter())); +/// } /// ``` #[derive(Debug)] -struct ColumnsRegion +pub struct ColumnsRegion where R: Region, Idx: Index, diff --git a/src/lib.rs b/src/lib.rs index 387cb0b..7aa5822 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,6 +37,7 @@ use serde::{Deserialize, Serialize}; pub mod codec; pub mod impls; +pub use impls::columns::ColumnsRegion; pub use impls::mirror::MirrorRegion; pub use impls::option::OptionRegion; pub use impls::result::ResultRegion;