Skip to main content

GetBuilder

Struct GetBuilder 

Source
pub struct GetBuilder<'a> { /* private fields */ }
Expand description

Fluent query builder for BidsLayout::get().

Provides a chainable API for filtering BIDS files by entity values, regex patterns, existence checks, and scope. Execute the query with collect() (for BidsFile objects), return_paths() (for PathBufs), or return_unique() (for unique entity values).

§Examples

// Basic entity filters
let files = layout.get()
    .suffix("eeg")
    .extension(".edf")
    .subject("01")
    .collect().unwrap();

// Multi-value and regex filters
let files = layout.get()
    .filter_any("subject", &["01", "02", "03"])
    .filter_regex("suffix", "(bold|sbref)")
    .collect().unwrap();

// Existence checks
let files = layout.get()
    .query_any("session")    // must have a session
    .query_none("recording") // must NOT have a recording
    .collect().unwrap();

// Get unique entity values
let tasks = layout.get()
    .suffix("bold")
    .return_unique("task").unwrap();

Implementations§

Source§

impl<'a> GetBuilder<'a>

Source

pub fn subject(self, v: &str) -> Self

Source

pub fn session(self, v: &str) -> Self

Source

pub fn task(self, v: &str) -> Self

Source

pub fn run(self, v: &str) -> Self

Source

pub fn datatype(self, v: &str) -> Self

Source

pub fn acquisition(self, v: &str) -> Self

Source

pub fn recording(self, v: &str) -> Self

Source

pub fn space(self, v: &str) -> Self

Source

pub fn suffix(self, v: &str) -> Self

Source

pub fn extension(self, value: &str) -> Self

Source

pub fn scope(self, scope: &str) -> Self

Set scope: “all”, “raw”, “derivatives”, “self”, or a pipeline name.

Source

pub fn invalid_filters(self, mode: InvalidFilters) -> Self

Set invalid filter handling.

Source

pub fn filter(self, entity: &str, value: &str) -> Self

Filter by entity name and exact value.

Source

pub fn filter_any(self, entity: &str, values: &[&str]) -> Self

Filter by entity with multiple allowed values.

Source

pub fn filter_regex(self, entity: &str, pattern: &str) -> Self

Filter by entity with regex.

Source

pub fn query_any(self, entity: &str) -> Self

Require entity to exist (any value).

Source

pub fn query_none(self, entity: &str) -> Self

Require entity to NOT exist.

Source

pub fn return_filenames(self) -> Self

Source

pub fn return_ids(self, target: &str) -> Self

Source

pub fn return_dirs(self, target: &str) -> Self

Source

pub fn collect(self) -> Result<Vec<BidsFile>>

Execute query, returning BidsFile objects.

Source

pub fn return_paths(self) -> Result<Vec<PathBuf>>

Execute query, returning file paths.

Source

pub fn return_unique(self, target: &str) -> Result<Vec<String>>

Execute query, returning unique values for a target entity.

Source

pub fn return_directories(self, target: &str) -> Result<Vec<String>>

Execute query, returning directories for a target entity.

Source

pub fn returns(self) -> Result<Vec<BidsFile>>

👎Deprecated since 0.2.0:

renamed to collect() for clarity

Deprecated: use collect() instead.

Auto Trait Implementations§

§

impl<'a> Freeze for GetBuilder<'a>

§

impl<'a> !RefUnwindSafe for GetBuilder<'a>

§

impl<'a> !Send for GetBuilder<'a>

§

impl<'a> !Sync for GetBuilder<'a>

§

impl<'a> Unpin for GetBuilder<'a>

§

impl<'a> UnsafeUnpin for GetBuilder<'a>

§

impl<'a> !UnwindSafe for GetBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.