compositor/session round-trips a toy snapshot of server state (counters, clients, toplevels) through EDN and edits one field by path: groundwork for persisting compositor state across a component swap. Adds the jqlssg/moonedn dependency. Builds and passes on native and wasm. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e769566d8f
commit
95b7275b3a
4 files changed
+35
No files matched your search
@@ -0,0 +1,18 @@
|
||||
///| Spike: session state as EDN (see the plan to persist compositor state across a component swap).
|
||||
|
||||
///| A toy snapshot with the shapes we need: ints, strings, nested maps/vectors, keywords.
|
||||
pub fn sample() -> String {
|
||||
"{:version 1 :server {:next-client 4 :next-serial 412 :selection [2 17]} :clients [{:id 2 :fd 11 :toplevels {5 {:title \"foot\" :min [0 0]}}}]}"
|
||||
}
|
||||
|
||||
///| Read, change one field by path, write back.
|
||||
pub fn bump_serial(text : String) -> String raise {
|
||||
let v = @edn.read(text)
|
||||
let next = @edn.transact(v, [
|
||||
@edn.Replace(
|
||||
[@edn.Key(@edn.Keyword("server")), @edn.Key(@edn.Keyword("next-serial"))],
|
||||
@edn.Integer("500"),
|
||||
),
|
||||
])
|
||||
@edn.write(next)
|
||||
}
|
||||
Reference in new issue
Block a user