Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Rust meets Mobile Keith Smiley (he/him) Principal Engineer, Lyft @SmileyKeith
Slide 2
Slide 2 text
Sharing code on mobile
Slide 3
Slide 3 text
Why rust?
Slide 4
Slide 4 text
Rust + bazel
Slide 5
Slide 5 text
rust_library( name = "foo", srcs = ["foo.rs"], ) swift_library( name = "main", srcs = ["main.swift"], deps = [":foo"], ) ios_application(...) Shouldn't this work?
Slide 6
Slide 6 text
--platforms=//:ios_arm64
Slide 7
Slide 7 text
bazel#7260
Slide 8
Slide 8 text
platform_mappings
Slide 9
Slide 9 text
flags: --cpu=arm64-v8a --crosstool_top=//external:android/crosstool //:android_aarch64 --cpu=ios_arm64 --apple_platform_type=ios //:ios_arm64 ...
Slide 10
Slide 10 text
Undefined symbols for architecture arm64: "___rust_alloc", referenced from: ... "___rust_alloc_error_handler", referenced from: ... ... rules_rust#1238 / rust#73632
Slide 11
Slide 11 text
Who does the linking?
Slide 12
Slide 12 text
How do I use it?
Slide 13
Slide 13 text
#[no_mangle] pub extern fn print_something_from_rust() { println!("Ferris says hello!"); } #[no_mangle] pub extern fn get_a_value_from_rust() -> i32 { 42 } extern void print_something_from_rust(void); extern int32_t get_a_value_from_rust(void);
Slide 14
Slide 14 text
#[no_mangle] pub extern "system" fn Java_com_example_androidapp_JniShim_getValue() -> i32 { get_a_value_from_rust() } package com.example.androidapp; public class JniShim { public static native int getValue(); }
Slide 15
Slide 15 text
dtolnay/cxx rust-lang/rust-bindgen
Slide 16
Slide 16 text
Future areas of improvement
Slide 17
Slide 17 text
Developer Experience
Slide 18
Slide 18 text
Future rust mobile support
Slide 19
Slide 19 text
Was it worth it?
Slide 20
Slide 20 text
keith/bazel-rust-mobile-demo
Slide 21
Slide 21 text
- bazel#11454 - bazel#15041 - bazel#15248 - bazel#15462 - bazel#7260 - cargo-raze#484 - cargo-raze#489 - rules_rust#1186 - rules_rust#1238 - rules_rust#1259 - rules_rust#1271 - rules_rust#1276 - rules_rust#1290 - rules_rust#1304 - rules_rust#1362 - rules_rust#1372 - rules_rust#1401 - rules_rust#1462 - rules_rust#1541 - rules_rust#1545 - rules_rust#1546 - rules_rust#1573 - rules_rust#1576 - rust#73632
Slide 22
Slide 22 text
Thank you! twitter.com/SmileyKeith