pub struct VariableCollection {
pub variables: HashMap<String, SimpleVariable>,
pub level: String,
pub entities: StringEntities,
}Expand description
A collection of simple BIDS variables at a single level of the hierarchy.
Groups SimpleVariables by name, automatically merging variables with
the same name and inferring the hierarchy level from the variable source
(events→run, participants→dataset, etc.).
Supports variable lookup by name, wildcard pattern matching, entity-based filtering, and subset selection.
Corresponds to PyBIDS’ BIDSVariableCollection class.
Fields§
§variables: HashMap<String, SimpleVariable>§level: String§entities: StringEntitiesImplementations§
Source§impl VariableCollection
impl VariableCollection
pub fn new(vars: Vec<SimpleVariable>) -> Self
pub fn get(&self, name: &str) -> Option<&SimpleVariable>
pub fn names(&self) -> Vec<&str>
Sourcepub fn match_variables(&self, pattern: &str, use_regex: bool) -> Vec<&str>
pub fn match_variables(&self, pattern: &str, use_regex: bool) -> Vec<&str>
Match variable names against a pattern (regex or glob).
Sourcepub fn to_rows(&self) -> Vec<StringEntities> ⓘ
pub fn to_rows(&self) -> Vec<StringEntities> ⓘ
Convert all variables to tabular rows (long format).
Sourcepub fn to_wide(&self) -> (Vec<String>, Vec<Vec<String>>)
pub fn to_wide(&self) -> (Vec<String>, Vec<Vec<String>>)
Convert to wide format: each variable becomes a column.
Returns (column_names, rows) where each row is a Vec<String>.
Sourcepub fn from_rows(rows: &[StringEntities], source: &str) -> Self
pub fn from_rows(rows: &[StringEntities], source: &str) -> Self
Create collection from tabular rows.
Trait Implementations§
Source§impl Clone for VariableCollection
impl Clone for VariableCollection
Source§fn clone(&self) -> VariableCollection
fn clone(&self) -> VariableCollection
Returns a duplicate 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 VariableCollection
impl Debug for VariableCollection
Source§impl Default for VariableCollection
impl Default for VariableCollection
Source§fn default() -> VariableCollection
fn default() -> VariableCollection
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for VariableCollection
impl RefUnwindSafe for VariableCollection
impl Send for VariableCollection
impl Sync for VariableCollection
impl Unpin for VariableCollection
impl UnsafeUnpin for VariableCollection
impl UnwindSafe for VariableCollection
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