euicc: convert JNI surface to shared jni_fn! macro
- Commit
12c810a528ce1f2a44f6619bf2ab94a5b948a38d- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 19:38 UTC (4 days ago)
- Parents
57cd01d
LOC Phase 5 rollout. All 14 euicc JNI functions (ten in jni.rs, four in jni_download.rs) repeated the EnvUnowned / with_env / LogErrorAndDefault scaffold and convert to jni_bridge::jni_fn!. Bodies are verbatim (verified token-for-token); handles, error-code mappings and null checks stay in the bodies, and the now-unused EnvUnowned imports are dropped. Lines: jni.rs + jni_download.rs 830 -> 719 (-111, -13.4%); structure_check euicc module counted after (structure: OK). Cargo.lock gains only the jni_bridge edge for euicc. Verified: nm -D on libeuicc.so before/after - exported symbol set identical (14/14 Java_ EuiccNative symbols); cargo test -p euicc: 107 passed; JVM bridge tests :euicc:testDevUnitTestNative EuiccNativeTest passed (run excludes the pre-existing rustFileLength ratchet); cargo fmt --check -p euicc clean.
Diff
Cargo.lock
diff --git a/Cargo.lock b/Cargo.lockindex bce933bf39..983a70abc6 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1921,6 +1921,7 @@ name = "euicc" version = "0.1.0" dependencies = [ "jni",+ "jni_bridge", "jni_http", "log", "serde_json",
euicc/src/main/rust/Cargo.toml
diff --git a/euicc/src/main/rust/Cargo.toml b/euicc/src/main/rust/Cargo.tomlindex 8c285b1120..91c0e3effb 100644--- a/euicc/src/main/rust/Cargo.toml+++ b/euicc/src/main/rust/Cargo.toml@@ -14,6 +14,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] jni.workspace = true+jni_bridge = { path = "../../../../library/jni-bridge/src/main/rust" } log.workspace = true serde_json.workspace = true sha2.workspace = true
euicc/src/main/rust/src/jni.rs
diff --git a/euicc/src/main/rust/src/jni.rs b/euicc/src/main/rust/src/jni.rsindex dd496354aa..373cd56108 100644--- a/euicc/src/main/rust/src/jni.rs+++ b/euicc/src/main/rust/src/jni.rs@@ -9,7 +9,8 @@ use jni::objects::{JByteArray, JClass, JString, JValue}; use jni::sys::{jint, jstring};-use jni::{jni_sig, jni_str, Env, EnvUnowned};+use jni::{jni_sig, jni_str, Env};+use jni_bridge::jni_fn; use crate::{es10, VERSION}; @@ -229,178 +230,104 @@ fn euicc_info_json(info: &es10::EuiccInfo1) -> String { .to_string() } -/// `nativeGetProfiles()` — installed profiles as a JSON array, or null on error.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeGetProfiles<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> {- let result = store_data(env, &es10::build_get_profiles())- .and_then(|resp| es10::parse_profiles(&resp));- Ok(match result {- Ok(profiles) => new_jstring(env, &profiles_json(&profiles)),- Err(_) => std::ptr::null_mut(),- })+// `nativeGetProfiles()` — installed profiles as a JSON array, or null on error.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeGetProfiles -> jstring; (_class: JClass<'l>) |env| {+ let result = store_data(env, &es10::build_get_profiles())+ .and_then(|resp| es10::parse_profiles(&resp));+ Ok(match result {+ Ok(profiles) => new_jstring(env, &profiles_json(&profiles)),+ Err(_) => std::ptr::null_mut(), })- .resolve::<jni::errors::LogErrorAndDefault>()-}+} } -/// `nativeEnableProfile(iccid)` — 0 on success, eUICC error code, or -1.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeEnableProfile<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- iccid: JString<'l>,-) -> jint {- env.with_env(|env| -> jni::errors::Result<jint> {- let Some(hex) = read_string(env, &iccid) else {- return Ok(-1);- };- Ok(run_result(- env,- &es10::build_enable(&es10::hex_decode(&hex), true),- es10::RESULT_TAG_ENABLE,- ))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}+// `nativeEnableProfile(iccid)` — 0 on success, eUICC error code, or -1.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeEnableProfile -> jint; (_class: JClass<'l>, iccid: JString<'l>) |env| {+ let Some(hex) = read_string(env, &iccid) else {+ return Ok(-1);+ };+ Ok(run_result(+ env,+ &es10::build_enable(&es10::hex_decode(&hex), true),+ es10::RESULT_TAG_ENABLE,+ ))+} } -/// `nativeDisableProfile(iccid)` — 0 on success, eUICC error code, or -1.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeDisableProfile<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- iccid: JString<'l>,-) -> jint {- env.with_env(|env| -> jni::errors::Result<jint> {- let Some(hex) = read_string(env, &iccid) else {- return Ok(-1);- };- Ok(run_result(- env,- &es10::build_disable(&es10::hex_decode(&hex), true),- es10::RESULT_TAG_DISABLE,- ))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}+// `nativeDisableProfile(iccid)` — 0 on success, eUICC error code, or -1.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeDisableProfile -> jint; (_class: JClass<'l>, iccid: JString<'l>) |env| {+ let Some(hex) = read_string(env, &iccid) else {+ return Ok(-1);+ };+ Ok(run_result(+ env,+ &es10::build_disable(&es10::hex_decode(&hex), true),+ es10::RESULT_TAG_DISABLE,+ ))+} } -/// `nativeDeleteProfile(iccid)` — 0 on success, eUICC error code, or -1.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeDeleteProfile<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- iccid: JString<'l>,-) -> jint {- env.with_env(|env| -> jni::errors::Result<jint> {- let Some(hex) = read_string(env, &iccid) else {- return Ok(-1);- };- Ok(run_result(env, &es10::build_delete(&es10::hex_decode(&hex)), es10::RESULT_TAG_DELETE))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}+// `nativeDeleteProfile(iccid)` — 0 on success, eUICC error code, or -1.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeDeleteProfile -> jint; (_class: JClass<'l>, iccid: JString<'l>) |env| {+ let Some(hex) = read_string(env, &iccid) else {+ return Ok(-1);+ };+ Ok(run_result(env, &es10::build_delete(&es10::hex_decode(&hex)), es10::RESULT_TAG_DELETE))+} } -/// `nativeSetNickname(iccid, nickname)` — 0 on success, eUICC error code, or -1.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeSetNickname<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- iccid: JString<'l>,- nickname: JString<'l>,-) -> jint {- env.with_env(|env| -> jni::errors::Result<jint> {- let (Some(hex), Some(name)) = (read_string(env, &iccid), read_string(env, &nickname))- else {- return Ok(-1);- };- Ok(run_result(- env,- &es10::build_set_nickname(&es10::hex_decode(&hex), &name),- es10::RESULT_TAG_SET_NICKNAME,- ))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}+// `nativeSetNickname(iccid, nickname)` — 0 on success, eUICC error code, or -1.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeSetNickname -> jint; (_class: JClass<'l>, iccid: JString<'l>, nickname: JString<'l>) |env| {+ let (Some(hex), Some(name)) = (read_string(env, &iccid), read_string(env, &nickname))+ else {+ return Ok(-1);+ };+ Ok(run_result(+ env,+ &es10::build_set_nickname(&es10::hex_decode(&hex), &name),+ es10::RESULT_TAG_SET_NICKNAME,+ ))+} } -/// `nativeListNotifications()` — pending notifications as a JSON array, or null.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeListNotifications<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> {- let result = store_data(env, &es10::build_list_notifications())- .and_then(|resp| es10::parse_notifications(&resp));- Ok(match result {- Ok(notes) => new_jstring(env, ¬ifications_json(¬es)),- Err(_) => std::ptr::null_mut(),- })+// `nativeListNotifications()` — pending notifications as a JSON array, or null.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeListNotifications -> jstring; (_class: JClass<'l>) |env| {+ let result = store_data(env, &es10::build_list_notifications())+ .and_then(|resp| es10::parse_notifications(&resp));+ Ok(match result {+ Ok(notes) => new_jstring(env, ¬ifications_json(¬es)),+ Err(_) => std::ptr::null_mut(), })- .resolve::<jni::errors::LogErrorAndDefault>()-}+} } -/// `nativeRemoveNotification(seq)` — 0 on success, eUICC error code, or -1.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeRemoveNotification<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- seq: jint,-) -> jint {- env.with_env(|env| -> jni::errors::Result<jint> {- let Some(seq) = seq_arg(seq) else {- return Ok(-1);- };- Ok(remove_code(store_data(env, &es10::build_remove_notification(seq))))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}+// `nativeRemoveNotification(seq)` — 0 on success, eUICC error code, or -1.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeRemoveNotification -> jint; (_class: JClass<'l>, seq: jint) |env| {+ let Some(seq) = seq_arg(seq) else {+ return Ok(-1);+ };+ Ok(remove_code(store_data(env, &es10::build_remove_notification(seq))))+} } -/// `nativeVersion()` — native core version string.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeVersion<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> { Ok(new_jstring(env, VERSION)) })- .resolve::<jni::errors::LogErrorAndDefault>()-}+// `nativeVersion()` — native core version string.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeVersion -> jstring; (_class: JClass<'l>) |env| {+ Ok(new_jstring(env, VERSION))+} } -/// `nativeGetEid()` — 32-hex-digit EID, or null on error (with a Kotlin-/// exception left pending is avoided; null signals failure).-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeGetEid<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> {- let result =- store_data(env, &es10::build_get_eid()).and_then(|resp| es10::parse_eid(&resp));- Ok(match result {- Ok(eid) => new_jstring(env, &eid),- Err(_) => std::ptr::null_mut(),- })+// `nativeGetEid()` — 32-hex-digit EID, or null on error (with a Kotlin+// exception left pending is avoided; null signals failure).+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeGetEid -> jstring; (_class: JClass<'l>) |env| {+ let result =+ store_data(env, &es10::build_get_eid()).and_then(|resp| es10::parse_eid(&resp));+ Ok(match result {+ Ok(eid) => new_jstring(env, &eid),+ Err(_) => std::ptr::null_mut(), })- .resolve::<jni::errors::LogErrorAndDefault>()-}+} } -/// `nativeGetEuiccInfo()` — EUICCInfo1 subset as a JSON string, or null on error.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeGetEuiccInfo<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> {- let result = store_data(env, &es10::build_get_euicc_info1())- .and_then(|resp| es10::parse_euicc_info1(&resp));- Ok(match result {- Ok(info) => new_jstring(env, &euicc_info_json(&info)),- Err(_) => std::ptr::null_mut(),- })+// `nativeGetEuiccInfo()` — EUICCInfo1 subset as a JSON string, or null on error.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeGetEuiccInfo -> jstring; (_class: JClass<'l>) |env| {+ let result = store_data(env, &es10::build_get_euicc_info1())+ .and_then(|resp| es10::parse_euicc_info1(&resp));+ Ok(match result {+ Ok(info) => new_jstring(env, &euicc_info_json(&info)),+ Err(_) => std::ptr::null_mut(), })- .resolve::<jni::errors::LogErrorAndDefault>()-}+} } #[cfg(test)] #[path = "jni_tests.rs"]
euicc/src/main/rust/src/jni_download.rs
diff --git a/euicc/src/main/rust/src/jni_download.rs b/euicc/src/main/rust/src/jni_download.rsindex 89a37487b9..59f1dd374d 100644--- a/euicc/src/main/rust/src/jni_download.rs+++ b/euicc/src/main/rust/src/jni_download.rs@@ -7,7 +7,8 @@ use jni::objects::{JClass, JString, JValue}; use jni::sys::{jboolean, jint, jstring};-use jni::{jni_sig, jni_str, Env, EnvUnowned};+use jni::{jni_sig, jni_str, Env};+use jni_bridge::jni_fn; use std::sync::{Mutex, MutexGuard}; @@ -133,126 +134,87 @@ where true } -/// `nativeDownloadProfile(activationCode)` — runs the full SGP.22 download for-/// an activation code and returns a JSON `{success, message, iccid}` string.-/// Must be called while the ISD-R channel is open (inside `withIsdrChannel`).-///-/// Kept for the `EuiccManagerService` platform path; the UI flow uses the-/// split-phase entries. No nickname is applied here — Settings shows the-/// carrier metadata, and the user can rename from the LUI.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeDownloadProfile<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- activation_code: JString<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> {- // Resolve the HTTP bridge (library:network) once; harmless if already done.- jni_http::init(env);-- let code = read_string(env, &activation_code);- let mut download_fn = |e: &mut Env, c: &str| crate::download::download_profile(e, c);- let json = run_download(env, code, &mut download_fn);- Ok(new_jstring(env, &json.to_string()))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}--/// `nativeAuthenticate(activationCode, confirmationCode, tacHex, imei)` —-/// runs InitiateAuthentication → AuthenticateServer → AuthenticateClient and-/// returns a JSON session `{error, transactionId, carrier, profileName, iccid,-/// ccRequired}` without touching the eUICC's profile store. The opaque-/// `transactionId` handle feeds `nativeFinishDownload` / `nativeCancelDownload`.-///-/// `tacHex` is 8 hex digits (defaults to lpac's `35 29 06 11` when blank);-/// `imei` is optional digits (dropped when blank/invalid).-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeAuthenticate<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- activation_code: JString<'l>,- confirmation_code: JString<'l>,- tac_hex: JString<'l>,- imei: JString<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> {- jni_http::init(env);-- let Some(code) = read_string(env, &activation_code) else {- return Ok(auth_error(env, "Invalid activation code"));- };- let options = download_options(env, &confirmation_code, &tac_hex, &imei);- let mut authenticate_fn = |e: &mut Env, c: &str, o: &download::DownloadOptions| {- crate::download::authenticate(e, c, o)- };- let json = run_authenticate(env, &code, &options, &mut authenticate_fn);- Ok(new_jstring(env, &json.to_string()))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}--/// `nativeFinishDownload(transactionId, confirmationCode)` — runs-/// PrepareDownload (with `hashCc`) → GetBoundProfilePackage → BPP install with-/// progress callbacks, returning `{success, message, iccid}`. Consumes the session.-/// `nickname` (from the carrier preview) is applied via SetNickname while the-/// channel is still open, so the profile shows a name immediately.-/// `nativeFinishDownload(transactionId, confirmationCode, nickname, callback)`-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeFinishDownload<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- transaction_id: JString<'l>,- confirmation_code: JString<'l>,- nickname: JString<'l>,- callback: jni::objects::JObject<'l>,-) -> jstring {- env.with_env(|env| -> jni::errors::Result<jstring> {- jni_http::init(env);-- let Some(handle) = read_string(env, &transaction_id) else {- return Ok(finish_json(env, false, "Invalid download session"));- };- let code = non_empty(read_string(env, &confirmation_code));- let nickname = non_blank(read_string(env, &nickname));- let mut progress = JniProgress { callback: env.new_global_ref(&callback).ok() };- let mut finish_fn = |e: &mut Env, s: &download::DownloadSession, c: Option<&str>| {- crate::download::finish_download(e, s, c, &mut progress)- };- let mut apply_nickname = |e: &mut Env, req: &[u8]| {- let _ = crate::jni::store_data(e, req);- };- let json = run_finish(- env,- &handle,- code.as_deref(),- nickname.as_deref(),- &mut finish_fn,- &mut apply_nickname,- );- Ok(new_jstring(env, &json.to_string()))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}--/// `nativeCancelDownload(transactionId, reason)` — ES10 CancelSession + ES9+-/// cancelSession for an authenticated-but-unfinished session. Best-effort;-/// always consumes the session and returns true.-#[no_mangle]-pub extern "system" fn Java_com_vayunmathur_euicc_EuiccNative_nativeCancelDownload<'l>(- mut env: EnvUnowned<'l>,- _class: JClass<'l>,- transaction_id: JString<'l>,- reason: jint,-) -> jboolean {- env.with_env(|env| -> jni::errors::Result<jboolean> {- let handle = read_string(env, &transaction_id);- let mut cancel_fn = |e: &mut Env, s: &download::DownloadSession, r: es10b::CancelReason| {- crate::download::cancel_session(e, s, r)- };- Ok(run_cancel(env, handle, reason, &mut cancel_fn))- })- .resolve::<jni::errors::LogErrorAndDefault>()-}+// `nativeDownloadProfile(activationCode)` — runs the full SGP.22 download for+// an activation code and returns a JSON `{success, message, iccid}` string.+// Must be called while the ISD-R channel is open (inside `withIsdrChannel`).+//+// Kept for the `EuiccManagerService` platform path; the UI flow uses the+// split-phase entries. No nickname is applied here — Settings shows the+// carrier metadata, and the user can rename from the LUI.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeDownloadProfile -> jstring; (_class: JClass<'l>, activation_code: JString<'l>) |env| {+ // Resolve the HTTP bridge (library:network) once; harmless if already done.+ jni_http::init(env);++ let code = read_string(env, &activation_code);+ let mut download_fn = |e: &mut Env, c: &str| crate::download::download_profile(e, c);+ let json = run_download(env, code, &mut download_fn);+ Ok(new_jstring(env, &json.to_string()))+} }++// `nativeAuthenticate(activationCode, confirmationCode, tacHex, imei)` —+// runs InitiateAuthentication → AuthenticateServer → AuthenticateClient and+// returns a JSON session `{error, transactionId, carrier, profileName, iccid,+// ccRequired}` without touching the eUICC's profile store. The opaque+// `transactionId` handle feeds `nativeFinishDownload` / `nativeCancelDownload`.+//+// `tacHex` is 8 hex digits (defaults to lpac's `35 29 06 11` when blank);+// `imei` is optional digits (dropped when blank/invalid).+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeAuthenticate -> jstring; (_class: JClass<'l>, activation_code: JString<'l>, confirmation_code: JString<'l>, tac_hex: JString<'l>, imei: JString<'l>) |env| {+ jni_http::init(env);++ let Some(code) = read_string(env, &activation_code) else {+ return Ok(auth_error(env, "Invalid activation code"));+ };+ let options = download_options(env, &confirmation_code, &tac_hex, &imei);+ let mut authenticate_fn = |e: &mut Env, c: &str, o: &download::DownloadOptions| {+ crate::download::authenticate(e, c, o)+ };+ let json = run_authenticate(env, &code, &options, &mut authenticate_fn);+ Ok(new_jstring(env, &json.to_string()))+} }++// `nativeFinishDownload(transactionId, confirmationCode)` — runs+// PrepareDownload (with `hashCc`) → GetBoundProfilePackage → BPP install with+// progress callbacks, returning `{success, message, iccid}`. Consumes the session.+// `nickname` (from the carrier preview) is applied via SetNickname while the+// channel is still open, so the profile shows a name immediately.+// `nativeFinishDownload(transactionId, confirmationCode, nickname, callback)`+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeFinishDownload -> jstring; (_class: JClass<'l>, transaction_id: JString<'l>, confirmation_code: JString<'l>, nickname: JString<'l>, callback: jni::objects::JObject<'l>) |env| {+ jni_http::init(env);++ let Some(handle) = read_string(env, &transaction_id) else {+ return Ok(finish_json(env, false, "Invalid download session"));+ };+ let code = non_empty(read_string(env, &confirmation_code));+ let nickname = non_blank(read_string(env, &nickname));+ let mut progress = JniProgress { callback: env.new_global_ref(&callback).ok() };+ let mut finish_fn = |e: &mut Env, s: &download::DownloadSession, c: Option<&str>| {+ crate::download::finish_download(e, s, c, &mut progress)+ };+ let mut apply_nickname = |e: &mut Env, req: &[u8]| {+ let _ = crate::jni::store_data(e, req);+ };+ let json = run_finish(+ env,+ &handle,+ code.as_deref(),+ nickname.as_deref(),+ &mut finish_fn,+ &mut apply_nickname,+ );+ Ok(new_jstring(env, &json.to_string()))+} }++// `nativeCancelDownload(transactionId, reason)` — ES10 CancelSession + ES9++// cancelSession for an authenticated-but-unfinished session. Best-effort;+// always consumes the session and returns true.+jni_fn! { Java_com_vayunmathur_euicc_EuiccNative_nativeCancelDownload -> jboolean; (_class: JClass<'l>, transaction_id: JString<'l>, reason: jint) |env| {+ let handle = read_string(env, &transaction_id);+ let mut cancel_fn = |e: &mut Env, s: &download::DownloadSession, r: es10b::CancelReason| {+ crate::download::cancel_session(e, s, r)+ };+ Ok(run_cancel(env, handle, reason, &mut cancel_fn))+} } // --------------------------------------------------------------------------- // Split-phase download helpers