mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 15:26:17 +00:00
style: cargo fmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1027ef6161
commit
7d338e6d30
4 files changed
+24
-7
No files matched your search
@@ -21,8 +21,12 @@ fn module_data_is_namespaced_listed_and_deleted() {
|
||||
g.set_module_data("a.mod", "entry/1", Some("x")).unwrap();
|
||||
g.set_module_data("a.mod", "entry/2", Some("y")).unwrap();
|
||||
g.set_module_data("a.mod", "vault", Some("h")).unwrap();
|
||||
g.set_module_data("b.mod", "entry/1", Some("other")).unwrap();
|
||||
assert_eq!(g.module_data("a.mod", "entry/1").unwrap().as_deref(), Some("x"));
|
||||
g.set_module_data("b.mod", "entry/1", Some("other"))
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
g.module_data("a.mod", "entry/1").unwrap().as_deref(),
|
||||
Some("x")
|
||||
);
|
||||
let keys: Vec<_> = g
|
||||
.module_data_list("a.mod", "entry/")
|
||||
.unwrap()
|
||||
|
||||
@@ -404,7 +404,11 @@ impl ModuleDto {
|
||||
version: m.version.clone(),
|
||||
description: m.description.clone(),
|
||||
author: m.author.clone(),
|
||||
permissions: m.permissions.iter().map(|p| p.as_str().to_string()).collect(),
|
||||
permissions: m
|
||||
.permissions
|
||||
.iter()
|
||||
.map(|p| p.as_str().to_string())
|
||||
.collect(),
|
||||
views: m
|
||||
.views
|
||||
.iter()
|
||||
|
||||
@@ -202,7 +202,9 @@ impl History {
|
||||
Op::DeletePage { id } => touched.extend(graph.hub_members(id)?),
|
||||
// Deletions and moves do not say which page lost a block; those
|
||||
// pages are caught by the `updated_at` scan below.
|
||||
Op::DeleteBlock { .. } | Op::PutAsset { .. } | Op::PutTypeDef { .. }
|
||||
Op::DeleteBlock { .. }
|
||||
| Op::PutAsset { .. }
|
||||
| Op::PutTypeDef { .. }
|
||||
| Op::PutModuleData { .. } => {}
|
||||
// The previous owner of an alias is unknown.
|
||||
Op::SetAlias { .. } => everything = true,
|
||||
|
||||
@@ -108,13 +108,17 @@ impl Running {
|
||||
.func_wrap(
|
||||
"synapse",
|
||||
"call",
|
||||
|mut caller: Caller<'_, HostState>, ptr: i32, len: i32| -> Result<i32, wasmi::Error> {
|
||||
|mut caller: Caller<'_, HostState>,
|
||||
ptr: i32,
|
||||
len: i32|
|
||||
-> Result<i32, wasmi::Error> {
|
||||
let req = read_bytes(&caller, ptr, len)?;
|
||||
let reply = match dispatch(caller.data_mut(), &req) {
|
||||
Ok(v) => json!({ "ok": v }),
|
||||
Err(e) => json!({ "error": e.to_string() }),
|
||||
};
|
||||
let bytes = serde_json::to_vec(&reply).map_err(|e| wasmi::Error::new(e.to_string()))?;
|
||||
let bytes =
|
||||
serde_json::to_vec(&reply).map_err(|e| wasmi::Error::new(e.to_string()))?;
|
||||
if bytes.len() > MAX_MESSAGE {
|
||||
return Err(wasmi::Error::new("host reply too large"));
|
||||
}
|
||||
@@ -139,7 +143,10 @@ impl Running {
|
||||
l.func_wrap(
|
||||
"synapse",
|
||||
"respond",
|
||||
|mut caller: Caller<'_, HostState>, ptr: i32, len: i32| -> Result<(), wasmi::Error> {
|
||||
|mut caller: Caller<'_, HostState>,
|
||||
ptr: i32,
|
||||
len: i32|
|
||||
-> Result<(), wasmi::Error> {
|
||||
let bytes = read_bytes(&caller, ptr, len)?;
|
||||
caller.data_mut().response = Some(bytes);
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user