pub struct HGrid {
pub meta: HDict,
pub cols: Vec<HCol>,
pub rows: Vec<HDict>,
}Expand description
Haystack Grid — the fundamental tabular data structure.
A grid has:
meta: grid-level metadata (anHDict)cols: ordered list of columns (HCol)rows: ordered list of row dicts (HDict)
Fields§
§meta: HDict§cols: Vec<HCol>§rows: Vec<HDict>Implementations§
Source§impl HGrid
impl HGrid
Sourcepub fn from_parts(meta: HDict, cols: Vec<HCol>, rows: Vec<HDict>) -> Self
pub fn from_parts(meta: HDict, cols: Vec<HCol>, rows: Vec<HDict>) -> Self
Create a grid from its constituent parts.
Sourcepub fn from_parts_arc(
meta: HDict,
cols: Vec<HCol>,
rows: Vec<Arc<HDict>>,
) -> Self
pub fn from_parts_arc( meta: HDict, cols: Vec<HCol>, rows: Vec<Arc<HDict>>, ) -> Self
Build a grid from Arc-wrapped rows, avoiding clones when possible.
Uses Arc::try_unwrap() to move the inner HDict when the reference count
is 1 (which is the common case in request pipelines). Falls back to clone
only for shared references.
Sourcepub fn col(&self, name: &str) -> Option<&HCol>
pub fn col(&self, name: &str) -> Option<&HCol>
Look up a column by name. Returns None if not found.
Sourcepub fn is_err(&self) -> bool
pub fn is_err(&self) -> bool
Returns true if this grid represents an error response.
An error grid has an err marker tag in its metadata.
Trait Implementations§
impl StructuralPartialEq for HGrid
Auto Trait Implementations§
impl Freeze for HGrid
impl RefUnwindSafe for HGrid
impl Send for HGrid
impl Sync for HGrid
impl Unpin for HGrid
impl UnsafeUnpin for HGrid
impl UnwindSafe for HGrid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more