pub struct BidsSchema {
pub version: String,
pub entities: Vec<EntityDef>,
pub datatypes: HashSet<String>,
pub suffixes: HashSet<String>,
pub extensions: HashSet<String>,
pub file_patterns: HashMap<String, Vec<Regex>>,
}Expand description
Full BIDS schema.
Fields§
§version: String§entities: Vec<EntityDef>§datatypes: HashSet<String>§suffixes: HashSet<String>§extensions: HashSet<String>§file_patterns: HashMap<String, Vec<Regex>>Filename validation patterns: datatype → vec of regex.
Implementations§
Source§impl BidsSchema
impl BidsSchema
Sourcepub fn check_dataset_version(&self, dataset_version_str: &str) -> Compatibility
pub fn check_dataset_version(&self, dataset_version_str: &str) -> Compatibility
Check compatibility between this schema and a dataset’s declared BIDS version.
§Example
use bids_schema::{BidsSchema, BidsVersion};
let schema = BidsSchema::load();
let compat = schema.check_dataset_version("1.8.0");
assert!(compat.is_ok());Sourcepub fn is_valid(&self, relative_path: &str) -> bool
pub fn is_valid(&self, relative_path: &str) -> bool
Validate a relative file path against BIDS naming rules.
Sourcepub fn get_entity(&self, name: &str) -> Option<&EntityDef>
pub fn get_entity(&self, name: &str) -> Option<&EntityDef>
Get entity definition by name.
Sourcepub fn get_entity_by_key(&self, key: &str) -> Option<&EntityDef>
pub fn get_entity_by_key(&self, key: &str) -> Option<&EntityDef>
Get entity definition by BIDS key (e.g., “sub”, “ses”).
Sourcepub fn is_valid_datatype(&self, dt: &str) -> bool
pub fn is_valid_datatype(&self, dt: &str) -> bool
Check if a datatype is valid.
Sourcepub fn is_valid_suffix(&self, s: &str) -> bool
pub fn is_valid_suffix(&self, s: &str) -> bool
Check if a suffix is valid.
Sourcepub fn is_valid_extension(&self, e: &str) -> bool
pub fn is_valid_extension(&self, e: &str) -> bool
Check if an extension is valid.
Sourcepub fn entity_pattern(&self, name: &str) -> Option<String>
pub fn entity_pattern(&self, name: &str) -> Option<String>
Generate a regex pattern string for an entity.
Trait Implementations§
Source§impl Clone for BidsSchema
impl Clone for BidsSchema
Source§fn clone(&self) -> BidsSchema
fn clone(&self) -> BidsSchema
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 moreAuto Trait Implementations§
impl Freeze for BidsSchema
impl RefUnwindSafe for BidsSchema
impl Send for BidsSchema
impl Sync for BidsSchema
impl Unpin for BidsSchema
impl UnsafeUnpin for BidsSchema
impl UnwindSafe for BidsSchema
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