pub struct Schemas;
Expand description
Starting point for defining the dimensions of a dataset.
ⓘ
use flat::Schema;
let my_schema = Schemas::two("dimension_0", "dimension_1");
Implementations§
Source§impl Schemas
impl Schemas
Sourcepub fn one<T>(dimension_0: impl Into<String>) -> Schema1<T>
pub fn one<T>(dimension_0: impl Into<String>) -> Schema1<T>
Define a 1-dimensional schema. The names of the dimensions are specified in order.
§Example
use flat::*;
// The inventory of animals in a zoo.
// This dataset has 2 bears, and 1 tiger.
let schema = Schemas::one("Animal");
let dataset = DatasetBuilder::new(schema)
// (Animal,)
.add(("Bear",))
.add(("Bear",))
.add(("Tiger",))
.build();
Sourcepub fn two<T, U>(
dimension_0: impl Into<String>,
dimension_1: impl Into<String>,
) -> Schema2<T, U>
pub fn two<T, U>( dimension_0: impl Into<String>, dimension_1: impl Into<String>, ) -> Schema2<T, U>
Define a 2-dimensional schema. The names of the dimensions are specified in order.
§Example
use flat::*;
// A dataset describing the zoo animal heights.
// This dataset has a bear which measures height "10", and another which measures height "11".
// There is also a tiger which measures height "5".
let schema = Schemas::two("Animal", "Height");
let dataset = DatasetBuilder::new(schema)
// (Animal, Height)
.add(("Bear", 10))
.add(("Bear", 11))
.add(("Tiger", 5))
.build();
Sourcepub fn three<T, U, V>(
dimension_0: impl Into<String>,
dimension_1: impl Into<String>,
dimension_2: impl Into<String>,
) -> Schema3<T, U, V>
pub fn three<T, U, V>( dimension_0: impl Into<String>, dimension_1: impl Into<String>, dimension_2: impl Into<String>, ) -> Schema3<T, U, V>
Define a 3-dimensional schema. The names of the dimensions are specified in order.
§Example
use flat::*;
// A dataset with zoo animal heights and their enclosures.
// This dataset has a bear which measures height "10", and another which measures height "11".
// There is also a tiger which measures height "5".
// The bears live in Pen01, while the tiger lives in Pen02.
let schema = Schemas::three("Animal", "Height", "Enclosure");
let dataset = DatasetBuilder::new(schema)
// (Animal, Height, Enclosure)
.add(("Bear", 10, "Pen01"))
.add(("Bear", 11, "Pen01"))
.add(("Tiger", 5, "Pen02"))
.build();
Sourcepub fn four<T, U, V, W>(
dimension_0: impl Into<String>,
dimension_1: impl Into<String>,
dimension_2: impl Into<String>,
dimension_3: impl Into<String>,
) -> Schema4<T, U, V, W>
pub fn four<T, U, V, W>( dimension_0: impl Into<String>, dimension_1: impl Into<String>, dimension_2: impl Into<String>, dimension_3: impl Into<String>, ) -> Schema4<T, U, V, W>
Define a 4-dimensional schema. The names of the dimensions are specified in order.
§Example
use flat::*;
// A dataset with zoo animal heights and their enclosures.
// This dataset has a bear which measures height "10", and another which measures height "11".
// There is also a tiger which measures height "5".
// The bears live in Pen01 (North East quadrant), while the tiger lives in Pen02 (South West quadrant).
let schema = Schemas::four("Animal", "Height", "Enclosure", "Quadrant");
let dataset = DatasetBuilder::new(schema)
// (Animal, Height, Enclosure, Quadrant)
.add(("Bear", 10, "Pen01", "NorthEast"))
.add(("Bear", 11, "Pen01", "NorthEast"))
.add(("Tiger", 5, "Pen02", "SouthWest"))
.build();
Auto Trait Implementations§
impl Freeze for Schemas
impl RefUnwindSafe for Schemas
impl Send for Schemas
impl Sync for Schemas
impl Unpin for Schemas
impl UnwindSafe for Schemas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more