Struct lace_codebook::ColMetadataList
source · pub struct ColMetadataList { /* private fields */ }Expand description
A structure that enforces unique IDs and names.
#Notes
Serializes to a Vec of ColMetadata and deserializes to a Vec of
ColMetadata.
Implementations§
source§impl ColMetadataList
impl ColMetadataList
sourcepub fn new(metadata: Vec<ColMetadata>) -> Result<Self, String>
pub fn new(metadata: Vec<ColMetadata>) -> Result<Self, String>
Create a new ColMetadataList. Returns an error – the column name –
if any of the ColMetadatas’ are not unique (case sensitive).
sourcepub fn push(&mut self, md: ColMetadata) -> Result<(), String>
pub fn push(&mut self, md: ColMetadata) -> Result<(), String>
Append a new column to the end of the list. Returns an error if the column’s name already exists.
sourcepub fn iter(&self) -> Iter<'_, ColMetadata>
pub fn iter(&self) -> Iter<'_, ColMetadata>
Iterate through the column metadata
sourcepub fn contains_key(&self, name: &str) -> bool
pub fn contains_key(&self, name: &str) -> bool
True if one of the columns has name
sourcepub fn name(&self, ix: usize) -> Option<&String>
pub fn name(&self, ix: usize) -> Option<&String>
Get the name of the column at index ix if it exists
sourcepub fn get(&self, name: &str) -> Option<(usize, &ColMetadata)>
pub fn get(&self, name: &str) -> Option<(usize, &ColMetadata)>
Return the integer index and the metadata of the column with name if
it exists. Otherwise return None.
sourcepub fn take(&mut self, name: &str) -> Option<ColMetadata>
pub fn take(&mut self, name: &str) -> Option<ColMetadata>
Take the column metadata with given key
sourcepub fn remove_by_index(&mut self, ix: usize)
pub fn remove_by_index(&mut self, ix: usize)
Remove the entries at ix and re-index
Trait Implementations§
source§impl Clone for ColMetadataList
impl Clone for ColMetadataList
source§fn clone(&self) -> ColMetadataList
fn clone(&self) -> ColMetadataList
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ColMetadataList
impl Debug for ColMetadataList
source§impl Default for ColMetadataList
impl Default for ColMetadataList
source§fn default() -> ColMetadataList
fn default() -> ColMetadataList
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for ColMetadataList
impl<'de> Deserialize<'de> for ColMetadataList
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<ColMetadataList> for Vec<ColMetadata>
impl From<ColMetadataList> for Vec<ColMetadata>
source§fn from(cols: ColMetadataList) -> Self
fn from(cols: ColMetadataList) -> Self
Converts to this type from the input type.
source§impl Index<usize> for ColMetadataList
impl Index<usize> for ColMetadataList
source§impl IndexMut<usize> for ColMetadataList
impl IndexMut<usize> for ColMetadataList
source§impl PartialEq<ColMetadataList> for ColMetadataList
impl PartialEq<ColMetadataList> for ColMetadataList
source§fn eq(&self, other: &ColMetadataList) -> bool
fn eq(&self, other: &ColMetadataList) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for ColMetadataList
impl Serialize for ColMetadataList
source§impl TryFrom<Vec<ColMetadata, Global>> for ColMetadataList
impl TryFrom<Vec<ColMetadata, Global>> for ColMetadataList
§type Error = ColMetadataListError
type Error = ColMetadataListError
The type returned in the event of a conversion error.
source§fn try_from(mds: Vec<ColMetadata>) -> Result<ColMetadataList, Self::Error>
fn try_from(mds: Vec<ColMetadata>) -> Result<ColMetadataList, Self::Error>
Performs the conversion.
impl StructuralPartialEq for ColMetadataList
Auto Trait Implementations§
impl RefUnwindSafe for ColMetadataList
impl Send for ColMetadataList
impl Sync for ColMetadataList
impl Unpin for ColMetadataList
impl UnwindSafe for ColMetadataList
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
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.