pub trait Platform {
    type PlatformRuntimeType: PlatformRuntime;
    type PlatformActiveData;

    // Required methods
    fn find_available_runtimes(
        &self,
        extra_paths: Box<dyn Iterator<Item = PathBuf> + '_>
    ) -> Result<(Vec<Self::PlatformRuntimeType>, Vec<ManifestError>), Error>;
    fn get_active_runtime_manifests(&self) -> Vec<PathBuf>;
    fn get_active_data(&self) -> Self::PlatformActiveData;
    fn get_runtime_active_state(
        &self,
        runtime: &Self::PlatformRuntimeType,
        active_data: &Self::PlatformActiveData
    ) -> ActiveState;
}
Expand description

Trait abstracting over the underlying system/platform type. For any given build, only a single implementation of this trait will be available. Having this as a trait is probably overkill but keeps the interface constrained?

Required Associated Types§

source

type PlatformRuntimeType: PlatformRuntime

Platform-specific type for a runtime, must implement PlatformType

source

type PlatformActiveData

Platform-specific data describing the currently active runtime(s). Meant to be opaque and just used in get_runtime_active_state()

Required Methods§

source

fn find_available_runtimes( &self, extra_paths: Box<dyn Iterator<Item = PathBuf> + '_> ) -> Result<(Vec<Self::PlatformRuntimeType>, Vec<ManifestError>), Error>

Enumerate all available runtimes we might be aware of.

source

fn get_active_runtime_manifests(&self) -> Vec<PathBuf>

Get the paths of all active runtime manifests. (There may be one per architecture.)

source

fn get_active_data(&self) -> Self::PlatformActiveData

Get a snapshot of what the active runtime(s) is/are, to use when checking if a runtime we know about is active. Returns a relatively opaque type used to pass into get_runtime_active_state()

source

fn get_runtime_active_state( &self, runtime: &Self::PlatformRuntimeType, active_data: &Self::PlatformActiveData ) -> ActiveState

Is the given runtime marked as active?

Some platforms might have separate 32-bit and 64-bit active runtime settings, which makes this more complex than a bool.

Implementors§