Giter Site home page Giter Site logo

cross-platform-rust's Introduction

cross-platform-rust

This is an example project showing a Rust library building for and running on multiple platforms.

If you want to create a simple Rust library that passes primitives to calling code on both iOS and Android, check out the basic project.

If you want to create a Rust library that passes more complex objects, check out the complex project.

You can read the blog posts for which this is an example:

cross-platform-rust's People

Contributors

grigoryk avatar rnewman avatar yazzpro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cross-platform-rust's Issues

Versioning

of crates and schema. How should this work.

make_standalone_toolchain.py: error: unrecognized arguments: --unified-headers

Hi, I was following the excellent article and came across this problem:

$ ${NDK_HOME}/build/tools/make_standalone_toolchain.py --unified-headers --api 21 --arch arm64 --install-dir NDK/arm64
usage: make_standalone_toolchain.py [-h] --arch
                                    {arm,arm64,mips,mips64,x86,x86_64}
                                    [--api API]
                                    [--stl {gnustl,libc++,stlport}] [--force]
                                    [-v]
                                    [--package-dir PACKAGE_DIR | --install-dir INSTALL_DIR]
make_standalone_toolchain.py: error: unrecognized arguments: --unified-headers

It looks like the --unified-headers option has been made the default. Does it make sense to update the article accordingly?

Enable Modularisation

Logins and Categories/Items are not necessarily required together. Enable the ability, through crates, to build a library that contains any combination of data types.

Use mentat instead of SQLite

Create a new project that uses the Toodle app created in complex objects as a base but that will use mentat as a data store instead of SQLite

Auto-generate FFI bindings

Figure out how to autogenerate bindings for JNI, Swift & JS flavours automatically. Should utilise existing tools where possible (e.g. cbindgen)

Dependency Management

It would be pretty awesome of we could provide appropriate packages for the relevent dependency management tools that our platforms might use, so that all clients have to do is import the dependency and don't have to worry about native wrappers and getting it right.

Target:

Cocoapods(iOS)
Carthage(iOS)
Gradle(Android)
npm(JavaScript)

any others?

Documentation Bug: Building and Deploying a Rust library on Android

I'm here to point a bug in one of the steps in the documentation. Specifically the part where the .so is soft linked to the proper jniLibs/ folder. That won't work, Gradle won't build using symbolic links as deps they need to copied directly.
thanks for the helpful tutorial. the one I was following was out of date I think.

Enable async

Currently, all data calls are synchronous which could cause problems when things go wrong. Enable the ability to set an async callback in the native platform that is called from Rust with the required return objects when the operation is complete.

"Complex" does not compile for ios

While basic example runs ok (on simulator), complex doesn't compile.
Swift compiler breaks while trying to compile ios project. Here is output:

  1. While running pass #17 SILFunctionTransform "AllocStackHoisting" on SILFunction "@$s6Toodle4ItemC7dueDate10Foundation0D0VSgvs".
    for setter for dueDate (at /Users/jarek/Projects/iosrust/cross-platform-rust/complex/ios/Toodle/Rust/List/Items/Item.swift:35:9)
  2. While converting type 'Int64'
    0 swift 0x000000010963feb3 PrintStackTraceSignalHandler(void*) + 51
    1 swift 0x000000010963f686 SignalHandler(int) + 358
    2 libsystem_platform.dylib 0x00007fff5fb76b5d _sigtramp + 29
    3 libsystem_platform.dylib 0x00007fa43a9f51b0 _sigtramp + 3672630896
    4 swift 0x0000000105401b12 swift::irgen::FixedTypeInfo::destroyStack(swift::irgen::IRGenFunction&, swift::irgen::StackAddress, swift::SILType, bool) const + 98
    5 swift 0x0000000105498f77 swift::irgen::TypeConverter::getTypeEntry(swift::CanType) + 3431
    6 swift 0x00000001052f7586 (anonymous namespace)::AllocStackHoisting::run() + 1046
    7 swift 0x000000010593ddb7 swift::SILPassManager::execute() + 4599
    8 swift 0x00000001054aa3bb runIRGenPreparePasses(swift::SILModule&, swift::irgen::IRGenModule&) + 1787
    9 swift 0x00000001054aae0d performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1069
    10 swift 0x00000001052975aa performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 36682
    11 swift 0x000000010528ae54 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
    12 swift 0x00000001052183c3 main + 1219
    13 libdyld.dylib 0x00007fff5f98b3d5 start + 1
    14 libdyld.dylib 0x0000000000000070 start + 2691124380
    error: Segmentation fault: 11 (in target 'Toodle' from project 'Toodle')

After commenting out most of properties it starts to compile but it doesn't work with all uncommeted

Enable error propogation

Sometimes when an error is thrown in Rust, we may want to propogate that error through to the native platform.

Sync

Sync data between devices

Scriptify library building

Instead of having to go through the rigmorole of creating multiple libraries for our different architectures, it would be nice if we had a simple script that could do it all for us.

This should include tackling the annoying replacing libraries inside Xcode problem.

Implement Toodle in Javascript

Complex Rust example app Toodle is available on iOS only. Implement app using the same library but called from Javascript.

Expose enums

We currently only expose structs, we should also expose enums

Error adding targets

I've met some issues trying to add targets for rustup

error: component 'rust-std' for target 'armv7-apple-ios' is unavailable for download for channel stable
error: component 'rust-std' for target 'armv7s-apple-ios' is unavailable for download for channel stable
error: component 'rust-std' for target 'i386-apple-ios' is unavailable for download for channel stable

only 2 targets passed
x86_64-apple-ios and aarch64-apple-ios

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.