Skip to main content

SimRegistry

Struct SimRegistry 

Source
pub struct SimRegistry { /* private fields */ }
Expand description

Loaded view of the registry, keyed by alias.

Implementations§

Source§

impl SimRegistry

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn sims(&self) -> &BTreeMap<String, RegisteredSim>

All registered sims, keyed by alias.

Source

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.

Trait Implementations§

Source§

impl Debug for SimRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.