pub struct SimRegistry { /* private fields */ }Expand description
Loaded view of the registry, keyed by alias.
Implementations§
Source§impl SimRegistry
impl SimRegistry
Sourcepub fn register(
path: &Path,
alias: &str,
sim: RegisteredSim,
) -> Result<RegisterOutcome, RegistryError>
pub fn register( path: &Path, alias: &str, sim: RegisteredSim, ) -> Result<RegisterOutcome, RegistryError>
Write sim into the registry under alias.
One key, not a whole file. The read-modify-write this replaces lost an alias whenever two processes registered at once — each read the file, each inserted its own row, and the second write erased the first, with no error on either side.
Sourcepub fn load(path: &Path) -> Result<Self, RegistryError>
pub fn load(path: &Path) -> Result<Self, RegistryError>
Read every registered sim.
path may be the .smix directory or a legacy sims.json
inside it; both land on the same store.
Sourcepub fn discover(start: &Path) -> Option<PathBuf>
pub fn discover(start: &Path) -> Option<PathBuf>
Walk up from start looking for a .smix that holds a
registry — either the store or a legacy sims.json.
Sourcepub fn resolve(&self, device_ref: &str) -> Result<String, RegistryError>
pub fn resolve(&self, device_ref: &str) -> Result<String, RegistryError>
Resolve a device ref to a UDID.
An explicit UDID passes through (normalized to uppercase) whether
or not it is registered — UDID-form input is always a deliberate
instruction. Otherwise the ref must match an alias key or a
deviceName exactly; anything else errors listing what exists.
Sourcepub fn sims(&self) -> &BTreeMap<String, RegisteredSim>
pub fn sims(&self) -> &BTreeMap<String, RegisteredSim>
All registered sims, keyed by alias.
Sourcepub fn lookup(&self, device_ref: &str) -> Option<&RegisteredSim>
pub fn lookup(&self, device_ref: &str) -> Option<&RegisteredSim>
Look up a RegisteredSim by alias key, device name, or UDID.
Returns None if no entry matches any of the three. Mirrors
Self::resolve’s match precedence so cli callers can fetch
the full spec (e.g. locale field) after they already resolved
the UDID.