2023-SNU-Rust-CorssPlatform
2023년 서울대학교 컴퓨터공학부 특강 - Rust 크로스 플랫폼 프로그래밍 발표 자료 및 예제 코드
Contents
Prerequisite
- Install Rust.
Rust + iOS
-
Install Xcode.
-
Install Xcode Command Line Tools:
xcode-select --install
- Add iOS architectures to support cross-compile:
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
- Install cargo-lipo for making universal library easily:
cargo install cargo-lipo
Rust + WebAssembly
brew install node
- Install yarn using homebrew:
brew install yarn
Quick Start
Rust + iOS
- Run this command inside the
rust-cross-ios
directory:
cargo-lipo --release
- That's it! You can run iOS example in Xcode.
Rust + WebAssembly
- Run this command inside the
rust-cross-web
directory:
wasm-pack build
- Copy
pkg
folder toexample-web
directory.
WebAssembly with TypeScript
- Ensure that the local development server and its dependencies are installed by running this command within the
example-web
directory:
npm install
- Run this command from within the
example-web
directory:
npm run start
- Go to
http://localhost:8080/
Generating Foreign-Language Bindings with UniFFI
Kotlin
cargo run --bin uniffi-bindgen generate src/calc.udl --language kotlin
Swift
cargo run --bin uniffi-bindgen generate src/calc.udl --language swift
References
- Rust Core
- Beginner
- Intermediate
- Advanced
- Rust + iOS
- Rust + WebAssembly
How To Contribute
Contributions are always welcome, either reporting issues/bugs or forking the repository and then issuing pull requests when you have completed some additional coding that you feel will be beneficial to the main project. If you are interested in contributing in a more dedicated capacity, then please contact me.
Contact
You can contact me via e-mail (utilForever at gmail.com). I am always happy to answer questions or help with any issues you might have, and please be sure to share any additional work or your creations with me, I love seeing what other people are making.
License
The class is licensed under the MIT License:
Copyright © 2023 Chris Ohk.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.