Struct StudyLocator
pub struct StudyLocator<'a> { /* private fields */ }Expand description
Resolves study identity through a storage backend’s optional catalog.
Construct one locator at an adapter boundary and use it for create, list
and name lookup decisions. A backend that does not opt into StudyCatalog
produces Error::Unsupported from every operation; callers must not fall
back to probing conventional crate::id::StudyId values.
Implementations§
§impl<'a> StudyLocator<'a>
impl<'a> StudyLocator<'a>
pub fn catalog(&self) -> Result<&dyn StudyCatalog>
pub fn catalog(&self) -> Result<&dyn StudyCatalog>
Returns the optional catalog capability, or a typed unsupported error.
This is the single capability check shared by the operation methods.
§Errors
Returns Error::Unsupported when the bound storage does not provide
a study catalog.
pub fn create_if_empty(&self, cfg: StudyConfig) -> Result<StudyCreateOutcome>
pub fn create_if_empty(&self, cfg: StudyConfig) -> Result<StudyCreateOutcome>
Atomically creates a study when the bound catalog is empty.
§Errors
Returns Error::Unsupported when the catalog is unavailable, or the
catalog’s backend error when creation fails.
pub fn list_studies(&self) -> Result<Vec<StudySummary>>
pub fn list_studies(&self) -> Result<Vec<StudySummary>>
Lists all study summaries in the catalog’s deterministic order.
§Errors
Returns Error::Unsupported when the catalog is unavailable, or the
catalog’s backend error when listing fails.
pub fn list(&self) -> Result<Vec<StudySummary>>
pub fn list(&self) -> Result<Vec<StudySummary>>
pub fn find_only(&self) -> Result<StudyLoadOutcome>
pub fn find_only(&self) -> Result<StudyLoadOutcome>
Applies the shared one-study policy to the catalog list.
An empty catalog is StudyLoadOutcome::NotFound, exactly one summary
is StudyLoadOutcome::Loaded, and any multi-study catalog is
StudyLoadOutcome::Conflict. The policy is intentionally implemented
here so CLI, Python and GUI adapters do not each count summaries (or
invent a numeric-id fallback).
§Errors
Returns Error::Unsupported when the catalog is unavailable, or the
catalog’s backend error when listing fails. An empty or ambiguous
catalog is returned as a typed StudyLoadOutcome.
pub fn load_only(&self) -> Result<StudyLoadOutcome>
pub fn load_only(&self) -> Result<StudyLoadOutcome>
pub fn find_by_name(&self, name: &str) -> Result<StudyLoadOutcome>
pub fn find_by_name(&self, name: &str) -> Result<StudyLoadOutcome>
Resolves an exact study name without selecting an ambiguous match.
§Errors
Returns Error::Unsupported when the catalog is unavailable, or the
catalog’s backend error when lookup fails.
pub fn load_by_name(&self, name: &str) -> Result<StudyLoadOutcome>
pub fn load_by_name(&self, name: &str) -> Result<StudyLoadOutcome>
Alias emphasizing that a successful lookup loads an identity.
§Errors
Returns the error from find_by_name.
Trait Implementations§
§impl<'a> Clone for StudyLocator<'a>
impl<'a> Clone for StudyLocator<'a>
§fn clone(&self) -> StudyLocator<'a>
fn clone(&self) -> StudyLocator<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more