From 6f2bd3e9497b3ce83312df72664db93e661dbe50 Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Sun, 7 Jun 2026 20:02:19 +0200 Subject: [PATCH] style: cargo fmt after Phase A Whitespace + import-grouping fixups in the 9 SDK modules touched by F-Q-002. No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/executor-core/src/sdk/dead_letters.rs | 7 +++-- crates/executor-core/src/sdk/docs.rs | 23 ++++++++++----- crates/executor-core/src/sdk/email.rs | 3 +- crates/executor-core/src/sdk/files.rs | 23 ++++++++++----- crates/executor-core/src/sdk/kv.rs | 19 ++++++++---- crates/executor-core/src/sdk/pubsub.rs | 5 ++-- crates/executor-core/src/sdk/secrets.rs | 6 ++-- crates/executor-core/src/sdk/users.rs | 31 +++++++++++++------- 8 files changed, 76 insertions(+), 41 deletions(-) diff --git a/crates/executor-core/src/sdk/dead_letters.rs b/crates/executor-core/src/sdk/dead_letters.rs index 873bb2e..423a04e 100644 --- a/crates/executor-core/src/sdk/dead_letters.rs +++ b/crates/executor-core/src/sdk/dead_letters.rs @@ -16,9 +16,9 @@ use std::str::FromStr; use std::sync::Arc; +use super::bridge::block_on; use picloud_shared::{DeadLetterId, SdkCallCx, Services}; use rhai::{Engine as RhaiEngine, EvalAltResult, Module}; -use super::bridge::block_on; use uuid::Uuid; pub(super) fn register(engine: &mut RhaiEngine, services: &Services, cx: Arc) { @@ -47,7 +47,9 @@ pub(super) fn register(engine: &mut RhaiEngine, services: &Services, cx: Arc Result> { .into() }) } - diff --git a/crates/executor-core/src/sdk/docs.rs b/crates/executor-core/src/sdk/docs.rs index b7ff11c..6a7c087 100644 --- a/crates/executor-core/src/sdk/docs.rs +++ b/crates/executor-core/src/sdk/docs.rs @@ -78,7 +78,9 @@ fn register_create(engine: &mut RhaiEngine) { |handle: &mut DocsHandle, data: Map| -> Result> { let h = handle.clone(); let json = dynamic_to_json(&Dynamic::from(data)); - let id = block_on("docs", async move { h.service.create(&h.cx, &h.collection, json).await })?; + let id = block_on("docs", async move { + h.service.create(&h.cx, &h.collection, json).await + })?; Ok(id.to_string()) }, ); @@ -90,8 +92,9 @@ fn register_get(engine: &mut RhaiEngine) { |handle: &mut DocsHandle, id: &str| -> Result> { let h = handle.clone(); let parsed_id = parse_doc_id(id)?; - let row = - block_on("docs", async move { h.service.get(&h.cx, &h.collection, parsed_id).await })?; + let row = block_on("docs", async move { + h.service.get(&h.cx, &h.collection, parsed_id).await + })?; Ok(row.map_or(Dynamic::UNIT, |d| Dynamic::from(doc_to_map(&d)))) }, ); @@ -103,7 +106,9 @@ fn register_find(engine: &mut RhaiEngine) { |handle: &mut DocsHandle, filter: Map| -> Result> { let h = handle.clone(); let json = dynamic_to_json(&Dynamic::from(filter)); - let rows = block_on("docs", async move { h.service.find(&h.cx, &h.collection, json).await })?; + let rows = block_on("docs", async move { + h.service.find(&h.cx, &h.collection, json).await + })?; Ok(rows .iter() .map(|d| Dynamic::from(doc_to_map(d))) @@ -118,8 +123,9 @@ fn register_find_one(engine: &mut RhaiEngine) { |handle: &mut DocsHandle, filter: Map| -> Result> { let h = handle.clone(); let json = dynamic_to_json(&Dynamic::from(filter)); - let row = - block_on("docs", async move { h.service.find_one(&h.cx, &h.collection, json).await })?; + let row = block_on("docs", async move { + h.service.find_one(&h.cx, &h.collection, json).await + })?; Ok(row.map_or(Dynamic::UNIT, |d| Dynamic::from(doc_to_map(&d)))) }, ); @@ -147,7 +153,9 @@ fn register_delete(engine: &mut RhaiEngine) { |handle: &mut DocsHandle, id: &str| -> Result> { let h = handle.clone(); let parsed_id = parse_doc_id(id)?; - block_on("docs", async move { h.service.delete(&h.cx, &h.collection, parsed_id).await }) + block_on("docs", async move { + h.service.delete(&h.cx, &h.collection, parsed_id).await + }) }, ); } @@ -231,4 +239,3 @@ fn parse_doc_id(id: &str) -> Result> { .into() }) } - diff --git a/crates/executor-core/src/sdk/email.rs b/crates/executor-core/src/sdk/email.rs index de14a35..eabd908 100644 --- a/crates/executor-core/src/sdk/email.rs +++ b/crates/executor-core/src/sdk/email.rs @@ -26,9 +26,9 @@ use std::sync::Arc; +use super::bridge::block_on; use picloud_shared::{OutboundEmail, SdkCallCx, Services}; use rhai::{Array, Engine as RhaiEngine, EvalAltResult, Map, Module}; -use super::bridge::block_on; pub(super) fn register(engine: &mut RhaiEngine, services: &Services, cx: Arc) { let svc = services.email.clone(); @@ -129,4 +129,3 @@ fn addresses(opts: &Map, key: &str) -> Result, Box> { fn runtime_err(msg: &str) -> Box { EvalAltResult::ErrorRuntime(msg.into(), rhai::Position::NONE).into() } - diff --git a/crates/executor-core/src/sdk/files.rs b/crates/executor-core/src/sdk/files.rs index 19b8ff0..2cd6dab 100644 --- a/crates/executor-core/src/sdk/files.rs +++ b/crates/executor-core/src/sdk/files.rs @@ -23,9 +23,9 @@ use std::sync::Arc; +use super::bridge::block_on; use picloud_shared::{FileMeta, FileUpdate, FilesService, NewFile, SdkCallCx, Services}; use rhai::{Array, Dynamic, Engine as RhaiEngine, EvalAltResult, Map, Module}; -use super::bridge::block_on; /// Per-call handle captured by the Rhai SDK. Cheap to clone (two Arcs /// plus an owned string). @@ -82,7 +82,9 @@ fn register_create(engine: &mut RhaiEngine) { content_type, data, }; - let id = block_on("files", async move { h.service.create(&h.cx, &h.collection, new).await })?; + let id = block_on("files", async move { + h.service.create(&h.cx, &h.collection, new).await + })?; Ok(id.to_string()) }, ); @@ -94,7 +96,9 @@ fn register_head(engine: &mut RhaiEngine) { |handle: &mut FilesHandle, id: &str| -> Result> { let h = handle.clone(); let id = id.to_string(); - let meta = block_on("files", async move { h.service.head(&h.cx, &h.collection, &id).await })?; + let meta = block_on("files", async move { + h.service.head(&h.cx, &h.collection, &id).await + })?; Ok(meta.map_or(Dynamic::UNIT, |m| file_meta_to_map(&m).into())) }, ); @@ -106,7 +110,9 @@ fn register_get(engine: &mut RhaiEngine) { |handle: &mut FilesHandle, id: &str| -> Result> { let h = handle.clone(); let id = id.to_string(); - let bytes = block_on("files", async move { h.service.get(&h.cx, &h.collection, &id).await })?; + let bytes = block_on("files", async move { + h.service.get(&h.cx, &h.collection, &id).await + })?; Ok(bytes.map_or(Dynamic::UNIT, Dynamic::from_blob)) }, ); @@ -126,7 +132,9 @@ fn register_update(engine: &mut RhaiEngine) { name, content_type, }; - block_on("files", async move { h.service.update(&h.cx, &h.collection, &id, upd).await }) + block_on("files", async move { + h.service.update(&h.cx, &h.collection, &id, upd).await + }) }, ); } @@ -137,7 +145,9 @@ fn register_delete(engine: &mut RhaiEngine) { |handle: &mut FilesHandle, id: &str| -> Result> { let h = handle.clone(); let id = id.to_string(); - block_on("files", async move { h.service.delete(&h.cx, &h.collection, &id).await }) + block_on("files", async move { + h.service.delete(&h.cx, &h.collection, &id).await + }) }, ); } @@ -257,4 +267,3 @@ fn require_blob(meta: &Map, field: &'static str) -> Result, Box Err(format!("files: missing required field '{field}'").into()), } } - diff --git a/crates/executor-core/src/sdk/kv.rs b/crates/executor-core/src/sdk/kv.rs index e3f1c7e..4457303 100644 --- a/crates/executor-core/src/sdk/kv.rs +++ b/crates/executor-core/src/sdk/kv.rs @@ -84,8 +84,10 @@ fn register_get(engine: &mut RhaiEngine) { "get", |handle: &mut KvHandle, key: &str| -> Result> { let h = handle.clone(); - block_on("kv", async move { h.service.get(&h.cx, &h.collection, key).await }) - .map(|opt| opt.map_or(Dynamic::UNIT, json_to_dynamic)) + block_on("kv", async move { + h.service.get(&h.cx, &h.collection, key).await + }) + .map(|opt| opt.map_or(Dynamic::UNIT, json_to_dynamic)) }, ); } @@ -96,7 +98,9 @@ fn register_set(engine: &mut RhaiEngine) { |handle: &mut KvHandle, key: &str, value: Dynamic| -> Result<(), Box> { let h = handle.clone(); let json = dynamic_to_json(&value); - block_on("kv", async move { h.service.set(&h.cx, &h.collection, key, json).await }) + block_on("kv", async move { + h.service.set(&h.cx, &h.collection, key, json).await + }) }, ); } @@ -106,7 +110,9 @@ fn register_has(engine: &mut RhaiEngine) { "has", |handle: &mut KvHandle, key: &str| -> Result> { let h = handle.clone(); - block_on("kv", async move { h.service.has(&h.cx, &h.collection, key).await }) + block_on("kv", async move { + h.service.has(&h.cx, &h.collection, key).await + }) }, ); } @@ -116,7 +122,9 @@ fn register_delete(engine: &mut RhaiEngine) { "delete", |handle: &mut KvHandle, key: &str| -> Result> { let h = handle.clone(); - block_on("kv", async move { h.service.delete(&h.cx, &h.collection, key).await }) + block_on("kv", async move { + h.service.delete(&h.cx, &h.collection, key).await + }) }, ); } @@ -166,4 +174,3 @@ fn list_call( ); Ok(m) } - diff --git a/crates/executor-core/src/sdk/pubsub.rs b/crates/executor-core/src/sdk/pubsub.rs index f3b6a12..9458db5 100644 --- a/crates/executor-core/src/sdk/pubsub.rs +++ b/crates/executor-core/src/sdk/pubsub.rs @@ -38,7 +38,9 @@ pub(super) fn register(engine: &mut RhaiEngine, services: &Services, cx: Arc Json { } Json::String(value.to_string()) } - diff --git a/crates/executor-core/src/sdk/secrets.rs b/crates/executor-core/src/sdk/secrets.rs index a467601..0db54fa 100644 --- a/crates/executor-core/src/sdk/secrets.rs +++ b/crates/executor-core/src/sdk/secrets.rs @@ -81,8 +81,9 @@ pub(super) fn register(engine: &mut RhaiEngine, services: &Services, cx: Arc Map { fn runtime_err(msg: &str) -> Box { EvalAltResult::ErrorRuntime(msg.into(), rhai::Position::NONE).into() } - diff --git a/crates/executor-core/src/sdk/users.rs b/crates/executor-core/src/sdk/users.rs index 708bf63..3b50d19 100644 --- a/crates/executor-core/src/sdk/users.rs +++ b/crates/executor-core/src/sdk/users.rs @@ -42,12 +42,12 @@ use std::sync::Arc; +use super::bridge::block_on; use picloud_shared::{ AppUser, AppUserId, CreateUserInput, EmailTemplateOpts, GeneratedAccept, GeneratedSession, InviteOpts, SdkCallCx, Services, UpdateUserInput, UsersListOpts, UsersListPage, UsersService, }; use rhai::{Array, Dynamic, Engine as RhaiEngine, EvalAltResult, Map, Module}; -use super::bridge::block_on; pub(super) fn register(engine: &mut RhaiEngine, services: &Services, cx: Arc) { let svc = services.users.clone(); @@ -198,8 +198,9 @@ fn bind_list(module: &mut Module, svc: &Arc, cx: &Arc, cx: &Arc = - block_on("users", async move { svc.login(&cx, &email, &password).await })?; + block_on( + "users", + async move { svc.login(&cx, &email, &password).await }, + )?; Ok(session_opt.map_or(Dynamic::UNIT, |s| Dynamic::from(s.token))) }, ); @@ -273,7 +277,9 @@ fn bind_send_verification_email( let opts = parse_email_template(&opts, "users::send_verification_email")?; let svc = svc.clone(); let cx = cx.clone(); - block_on("users", async move { svc.send_verification_email(&cx, id, opts).await }) + block_on("users", async move { + svc.send_verification_email(&cx, id, opts).await + }) }, ); } @@ -307,7 +313,9 @@ fn bind_request_password_reset( let opts = parse_email_template(&opts, "users::request_password_reset")?; let svc = svc.clone(); let cx = cx.clone(); - block_on("users", async move { svc.request_password_reset(&cx, &email, opts).await }) + block_on("users", async move { + svc.request_password_reset(&cx, &email, opts).await + }) }, ); } @@ -365,8 +373,9 @@ fn bind_accept_invite(module: &mut Module, svc: &Arc, cx: &Arc let password = password.to_string(); let svc = svc.clone(); let cx = cx.clone(); - let accept_opt: Option = - block_on("users", async move { svc.accept_invite(&cx, &token, &password, None).await })?; + let accept_opt: Option = block_on("users", async move { + svc.accept_invite(&cx, &token, &password, None).await + })?; Ok(accept_opt.map_or(Dynamic::UNIT, |a| Dynamic::from(a.session.token))) }, ); @@ -428,7 +437,10 @@ fn bind_remove_role(module: &mut Module, svc: &Arc, cx: &Arc Option { fn runtime_err(msg: &str) -> Box { EvalAltResult::ErrorRuntime(msg.into(), rhai::Position::NONE).into() } -