Platform

Trait Platform 

Source
pub trait Platform: Send + Sync {
    type Toolchain: Toolchain;
    type Device: Device;

    // Required methods
    fn clean(
        &self,
        project: &Project,
    ) -> impl Future<Output = Result<()>> + Send;
    fn package(
        &self,
        project: &Project,
        options: PackageOptions,
    ) -> impl Future<Output = Result<Artifact>> + Send;
    fn toolchain(&self) -> Self::Toolchain;
    fn scan(&self) -> impl Future<Output = Result<Vec<Self::Device>>> + Send;
    fn triple(&self) -> Triple;
    fn build(
        &self,
        project: &Project,
        options: BuildOptions,
    ) -> impl Future<Output = Result<PathBuf>> + Send;
}
Expand description

Trait representing a specific platform (e.g., Android, iOS, etc.)

Note: Platform would never check toolchain since it is the responsibility of the Toolchain. We assume the toolchain is already set up correctly when calling methods of this trait.

Required Associated Types§

Source

type Toolchain: Toolchain

The associated toolchain type for this platform.

Source

type Device: Device

The associated device type for this platform.

Required Methods§

Source

fn clean(&self, project: &Project) -> impl Future<Output = Result<()>> + Send

Clean build artifacts for this platform (not include rust build artifacts)

Source

fn package( &self, project: &Project, options: PackageOptions, ) -> impl Future<Output = Result<Artifact>> + Send

Package the project for this platform

Return the path to the packaged file

§Warnings

You should call build before calling this method to ensure the project is built for the platform.

Source

fn toolchain(&self) -> Self::Toolchain

Get the toolchain for this platform

Source

fn scan(&self) -> impl Future<Output = Result<Vec<Self::Device>>> + Send

Scan for connected devices for this platform

Source

fn triple(&self) -> Triple

Get the target triple for this platform

Source

fn build( &self, project: &Project, options: BuildOptions, ) -> impl Future<Output = Result<PathBuf>> + Send

Build the Rust library for this platform

Warning: This method would build and copy the built library to the appropriate location in the project directory. However, it does not handle hot reload library building or management.

Return the target directory path where the built library is located.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§