mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
wip: reenable dynamic dispatch
This commit is contained in:
parent
600d0b3aca
commit
ac3827b8f3
11 changed files with 997 additions and 194 deletions
698
edn/Cargo.lock
generated
698
edn/Cargo.lock
generated
|
|
@ -2,12 +2,85 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.24.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||
|
||||
[[package]]
|
||||
name = "allocator-api2"
|
||||
version = "0.2.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "better-panic"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fa9e1d11a268684cbd90ed36370d7577afb6c62d912ddff5c15fc34343e5036"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"console",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||
|
||||
[[package]]
|
||||
name = "cassowary"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
|
||||
|
||||
[[package]]
|
||||
name = "castaway"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5"
|
||||
dependencies = [
|
||||
"rustversion",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "clojure-reader"
|
||||
version = "0.3.0"
|
||||
|
|
@ -17,12 +90,201 @@ dependencies = [
|
|||
"ordered-float",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "compact_str"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32"
|
||||
dependencies = [
|
||||
"castaway",
|
||||
"cfg-if",
|
||||
"itoa",
|
||||
"rustversion",
|
||||
"ryu",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.15.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const_panic"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53857514f72ee4a2b583de67401e3ff63a5472ca4acf289d09a9ea7636dfec17"
|
||||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crossterm_winapi",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"rustix",
|
||||
"signal-hook",
|
||||
"signal-hook-mio",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossterm_winapi"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"equivalent",
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "indoc"
|
||||
version = "2.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
||||
|
||||
[[package]]
|
||||
name = "instability"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "894813a444908c0c8c0e221b041771d107c4a21de1d317dc49bcc66e3c9e5b3f"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"indoc",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
||||
|
||||
[[package]]
|
||||
name = "konst"
|
||||
version = "0.3.16"
|
||||
|
|
@ -50,6 +312,70 @@ version = "0.3.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00af7901ba50898c9e545c24d5c580c96a982298134e8037d8978b6594782c07"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.169"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "lru"
|
||||
version = "0.12.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
|
|
@ -59,6 +385,21 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
version = "4.6.0"
|
||||
|
|
@ -68,12 +409,224 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "paste"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"compact_str",
|
||||
"crossterm",
|
||||
"indoc",
|
||||
"instability",
|
||||
"itertools",
|
||||
"lru",
|
||||
"paste",
|
||||
"strum",
|
||||
"unicode-segmentation",
|
||||
"unicode-truncate",
|
||||
"unicode-width 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"signal-hook-registry",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-mio"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"mio",
|
||||
"signal-hook",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
|
||||
dependencies = [
|
||||
"strum_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "987bc0be1cdea8b10216bd06e2ca407d40b9543468fafd3ddfb02f36e77f71f3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tek_edn"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clojure-reader",
|
||||
"konst",
|
||||
"tek_layout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tek_engine"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"better-panic",
|
||||
"crossterm",
|
||||
"ratatui",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tek_layout"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"tek_engine",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -90,3 +643,148 @@ name = "typewit_proc_macros"
|
|||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-truncate"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"unicode-segmentation",
|
||||
"unicode-width 0.1.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
|
|
|||
|
|
@ -6,3 +6,8 @@ version = "0.1.0"
|
|||
[dependencies]
|
||||
clojure-reader = "0.3.0"
|
||||
konst = "0.3.16"
|
||||
tek_layout = { optional = true, path = "../layout" }
|
||||
|
||||
[features]
|
||||
default = ["layout"]
|
||||
layout = [ "tek_layout" ]
|
||||
|
|
|
|||
|
|
@ -1,118 +1,194 @@
|
|||
use crate::*;
|
||||
use std::marker::PhantomData;
|
||||
use ::tek_layout::{*, tek_engine::{Content, Render, Engine, Thunk}};
|
||||
use Item::*;
|
||||
|
||||
#[cfg(test)] #[test] fn test_edn_layout () -> Result<(), ParseError> {
|
||||
let source = include_str!("example.edn");
|
||||
let layout = Item::read_all(source)?;
|
||||
panic!("{layout:?}");
|
||||
let content = EdnLayout::from(&layout);
|
||||
Ok(())
|
||||
}
|
||||
pub struct EdnContent<'a, E, T: AsRef<str>>(PhantomData<E>, &'a [Item<T>]);
|
||||
|
||||
impl<'a> From<&'a [Item]> for EdnLayout<'a> {
|
||||
fn from (items: &'a [Item]) -> Self {
|
||||
Self(items)
|
||||
impl<'a, E, T: AsRef<str>> From<&'a [Item<T>]> for EdnContent<'a, E, T> {
|
||||
fn from (items: &'a [Item<T>]) -> Self {
|
||||
Self(Default::default(), items)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct EdnLayout<'a, E>(&'a [Item]);
|
||||
impl<'a, E> EdnLayout<'a, E> {
|
||||
fn get_content (&self) -> impl Content<E> {
|
||||
}
|
||||
}
|
||||
//impl<'a, E: Engine> Content<E> for EdnContent<'a, E> {
|
||||
/*todo*/
|
||||
//}
|
||||
|
||||
//pub struct EdnContent<'a, T>(T, &'a [Item]);
|
||||
|
||||
#[macro_export] macro_rules! edn_ns {
|
||||
($name:literal = $Host:ident<$E:ident: $Engine:path> |$args:ident| { $(
|
||||
($fn:literal
|
||||
$Struct:ident
|
||||
$(<$($G:ident$(: $Generic:ty)?),+>)?
|
||||
$(::$Variant:ident)?
|
||||
($($arg:expr),*))
|
||||
)* }) => {
|
||||
//pub trait $Host<$E: Engine> {
|
||||
//fn read_one <'e> (edn: &[Edn<'e>]) -> impl Content<$E> {
|
||||
//if let Some(Edn::Symbol(name)) = edn.get(0) {
|
||||
//match *name {
|
||||
//$(
|
||||
//$fn => $Struct$(::$Variant)?($($arg),+),
|
||||
//)*
|
||||
//_ => {}
|
||||
//}
|
||||
//} else {
|
||||
//panic!("invalid edn")
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
};
|
||||
pub trait EdnLayout<E: Engine + 'static> {
|
||||
fn get_bool (&self, item: &Item<&str>) -> bool { todo!() }
|
||||
fn get_unit (&self, item: &Item<&str>) -> E::Unit { todo!() }
|
||||
fn get_usize (&self, key: &str) -> usize { todo!() }
|
||||
fn get_content (&self, item: &Item<&str>) -> &dyn Render<E> { todo!() }
|
||||
fn parse <'a: 'static> (&'a self, items: &[Item<&str>]) -> Box<dyn Render<E> + 'a> {
|
||||
match items {
|
||||
[Key("when"), c, a, ..] =>
|
||||
Box::new(When(self.get_bool(c), self.get_content(a))),
|
||||
[Key("either"), c, a, b, ..] =>
|
||||
Box::new(Either(self.get_bool(c), self.get_content(a), self.get_content(b))),
|
||||
|
||||
[Key("fill"), a, ..] =>
|
||||
Box::new(Fill::xy(self.get_content(a))),
|
||||
[Key("fill/x"), a, ..] => Box::new(Fill::x(self.get_content(a))),
|
||||
[Key("fill/y"), a, ..] => Box::new(Fill::y(self.get_content(a))),
|
||||
|
||||
[Key("fixed"), x, y, a, ..] =>
|
||||
Box::new(Fixed::xy(self.get_unit(x), self.get_unit(y), self.get_content(a))),
|
||||
[Key("fixed/x"), x, a, ..] => Box::new(Fixed::x(self.get_unit(x), self.get_content(a))),
|
||||
[Key("fixed/y"), y, a, ..] => Box::new(Fixed::y(self.get_unit(y), self.get_content(a))),
|
||||
|
||||
[Key("shrink"), x, y, a, ..] =>
|
||||
Box::new(Shrink::xy(self.get_unit(x), self.get_unit(y), self.get_content(a))),
|
||||
[Key("shrink/x"), x, a, ..] => Box::new(Shrink::x(self.get_unit(x), self.get_content(a))),
|
||||
[Key("shrink/y"), y, a, ..] => Box::new(Shrink::y(self.get_unit(y), self.get_content(a))),
|
||||
|
||||
[Key("expand"), x, y, a, ..] =>
|
||||
Box::new(Expand::xy(self.get_unit(x), self.get_unit(y), self.get_content(a))),
|
||||
[Key("expand/x"), x, a, ..] => Box::new(Expand::x(self.get_unit(x), self.get_content(a))),
|
||||
[Key("expand/y"), y, a, ..] => Box::new(Expand::y(self.get_unit(y), self.get_content(a))),
|
||||
|
||||
[Key("push"), x, y, a, ..] =>
|
||||
Box::new(Push::xy(self.get_unit(x), self.get_unit(y), self.get_content(a))),
|
||||
[Key("push/x"), x, a, ..] => Box::new(Push::x(self.get_unit(x), self.get_content(a))),
|
||||
[Key("push/y"), y, a, ..] => Box::new(Push::y(self.get_unit(y), self.get_content(a))),
|
||||
|
||||
[Key("pull"), x, y, a, ..] =>
|
||||
Box::new(Pull::xy(self.get_unit(x), self.get_unit(y), self.get_content(a))),
|
||||
[Key("pull/x"), x, a, ..] => Box::new(Pull::x(self.get_unit(x), self.get_content(a))),
|
||||
[Key("pull/y"), y, a, ..] => Box::new(Pull::y(self.get_unit(y), self.get_content(a))),
|
||||
|
||||
_ => Box::new(())
|
||||
//[Key("when"), Sym(condition), Sym(template)] => When(
|
||||
//self.get_bool(condition),
|
||||
//self.get_content(template)),
|
||||
//[Key("when"), Sym(condition), Exp(template)] => When(
|
||||
//self.get_bool(condition),
|
||||
//Thunk::new(||EdnLayout::parse(template))),
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
edn_ns! {
|
||||
macro_rules! edn_context {
|
||||
($Struct:ident |$l:lifetime, $state:ident| {
|
||||
$($key:literal = $field:ident: $Type:ty => $expr:expr,)*
|
||||
}) => {
|
||||
|
||||
"when" = When<A>(args[0].into(), args[1].into()),
|
||||
|
||||
"either" = Either<A, B>(args[0].into(), args[1].into(), args[2].into()),
|
||||
|
||||
"map" = Map<A, B, I, F, G>(args[0].into(), args[1].into()),
|
||||
|
||||
"fill" = edn_ns! {
|
||||
"x" = Fixed<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Fixed<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Fixed<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"fixed" = edn_ns! {
|
||||
"x" = Fixed<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Fixed<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Fixed<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"shrink" = edn_ns! {
|
||||
"x" = Shrink<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Shrink<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Shrink<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"expand" = edn_ns! {
|
||||
"x" = Expand<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Expand<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Expand<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"min" = edn_ns! {
|
||||
"x" = Min<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Min<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Min<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"max" = edn_ns! {
|
||||
"x" = Max<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Max<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Max<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"push" = edn_ns! {
|
||||
"x" = Push<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Push<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Push<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"pull" = edn_ns! {
|
||||
"x" = Pull<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Pull<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Pull<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"margin" = edn_ns! {
|
||||
"x" = Margin<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Margin<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Margin<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
|
||||
"padding" = edn_ns! {
|
||||
"x" = Padding<T>::X(args[0].into(), args[1].into()),
|
||||
"y" = Padding<T>::Y(args[0].into(), args[1].into()),
|
||||
"xy" = Padding<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
},
|
||||
#[derive(Default)]
|
||||
pub struct EdnView<$l> { $($field: Option<$Type>),* }
|
||||
|
||||
impl<$l> EdnView<$l> {
|
||||
pub fn parse <'e> (edn: &[Edn<'e>]) -> impl Fn(&$Struct) + use<'e> {
|
||||
let imports = Self::imports_all(edn);
|
||||
move |state| {
|
||||
let mut context = EdnView::default();
|
||||
for import in imports.iter() {
|
||||
context.import(state, import)
|
||||
}
|
||||
}
|
||||
}
|
||||
fn imports_all <'e> (edn: &[Edn<'e>]) -> Vec<&'e str> {
|
||||
let mut imports = vec![];
|
||||
for edn in edn.iter() {
|
||||
for import in Self::imports_one(edn) {
|
||||
imports.push(import);
|
||||
}
|
||||
}
|
||||
imports
|
||||
}
|
||||
fn imports_one <'e> (edn: &Edn<'e>) -> Vec<&'e str> {
|
||||
match edn {
|
||||
Edn::Symbol(import) => vec![import],
|
||||
Edn::List(edn) => Self::imports_all(edn.as_slice()),
|
||||
_ => vec![],
|
||||
}
|
||||
}
|
||||
pub fn import (&mut self, $state: &$l$Struct, key: &str) {
|
||||
match key {
|
||||
$($key => self.$field = Some($expr),)*
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//edn_ns! { EdnLayout |context, item| {
|
||||
|
||||
//[Key("when"), Sym(condition), Sym(template)] => When(
|
||||
//context.get_bool(condition),
|
||||
//context.get_template(template)),
|
||||
|
||||
//[Key("when"), Sym(condition), Exp(template)] => When(
|
||||
//context.get_bool(condition),
|
||||
//Thunk::new(||EdnLayout::parse(template))),
|
||||
|
||||
//"when" => When(item.0[1].into(), item.0[2].into())
|
||||
|
||||
////"either" = Either<A, B>(args[0].into(), args[1].into(), args[2].into()),
|
||||
|
||||
////"map" = Map<A, B, I, F, G>(args[0].into(), args[1].into()),
|
||||
|
||||
////"fill" = edn_ns! {
|
||||
////"x" = Fixed<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Fixed<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Fixed<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"fixed" = edn_ns! {
|
||||
////"x" = Fixed<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Fixed<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Fixed<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"shrink" = edn_ns! {
|
||||
////"x" = Shrink<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Shrink<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Shrink<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"expand" = edn_ns! {
|
||||
////"x" = Expand<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Expand<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Expand<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"min" = edn_ns! {
|
||||
////"x" = Min<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Min<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Min<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"max" = edn_ns! {
|
||||
////"x" = Max<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Max<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Max<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"push" = edn_ns! {
|
||||
////"x" = Push<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Push<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Push<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"pull" = edn_ns! {
|
||||
////"x" = Pull<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Pull<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Pull<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"margin" = edn_ns! {
|
||||
////"x" = Margin<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Margin<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Margin<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
////"padding" = edn_ns! {
|
||||
////"x" = Padding<T>::X(args[0].into(), args[1].into()),
|
||||
////"y" = Padding<T>::Y(args[0].into(), args[1].into()),
|
||||
////"xy" = Padding<T>::XY(args[0].into(), args[1].into(), args[2].into()),
|
||||
////},
|
||||
|
||||
//} }
|
||||
|
|
|
|||
|
|
@ -2,27 +2,6 @@ use std::sync::{Arc, RwLock};
|
|||
use std::collections::BTreeMap;
|
||||
pub use clojure_reader::edn::Edn;
|
||||
|
||||
#[cfg(test)] #[test] fn test_edn () -> Result<(), ParseError> {
|
||||
use Item::*;
|
||||
assert_eq!(Item::read_all("")?,
|
||||
vec![]);
|
||||
assert_eq!(Item::read_all(" ")?,
|
||||
vec![]);
|
||||
assert_eq!(Item::read_all("1234")?,
|
||||
vec![Num(1234)]);
|
||||
assert_eq!(Item::read_all("1234 5 67")?,
|
||||
vec![Num(1234), Num(5), Num(67)]);
|
||||
assert_eq!(Item::read_all("foo/bar")?,
|
||||
vec![Key("foo/bar".into())]);
|
||||
assert_eq!(Item::read_all(":symbol")?,
|
||||
vec![Sym(":symbol".into())]);
|
||||
assert_eq!(Item::read_all(" foo/bar :baz 456")?,
|
||||
vec![Key("foo/bar".into()), Sym(":baz".into()), Num(456)]);
|
||||
assert_eq!(Item::read_all(" (foo/bar :baz 456) ")?,
|
||||
vec![Exp(vec![Key("foo/bar".into()), Sym(":baz".into()), Num(456)])]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn number (digits: &str) -> usize {
|
||||
let mut value = 0;
|
||||
for c in digits.chars() {
|
||||
|
|
@ -44,15 +23,15 @@ pub enum ParseError {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq)]
|
||||
pub enum Item {
|
||||
pub enum Item<T: AsRef<str>> {
|
||||
#[default] Nil,
|
||||
Num(usize),
|
||||
Sym(String),
|
||||
Key(String),
|
||||
Exp(Vec<Item>),
|
||||
Sym(T),
|
||||
Key(T),
|
||||
Exp(Vec<Item<T>>),
|
||||
}
|
||||
|
||||
impl Item {
|
||||
impl Item<String> {
|
||||
pub fn read_all <'a> (mut source: &'a str) -> Result<Vec<Self>, ParseError> {
|
||||
let mut items = vec![];
|
||||
loop {
|
||||
|
|
|
|||
|
|
@ -1,2 +1,34 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_fn_trait_return)]
|
||||
|
||||
mod edn_lib; pub use self::edn_lib::*;
|
||||
mod edn_layout; pub use self::edn_layout::*;
|
||||
|
||||
#[cfg(test)] #[test] fn test_edn () -> Result<(), ParseError> {
|
||||
use Item::*;
|
||||
assert_eq!(Item::read_all("")?,
|
||||
vec![]);
|
||||
assert_eq!(Item::read_all(" ")?,
|
||||
vec![]);
|
||||
assert_eq!(Item::read_all("1234")?,
|
||||
vec![Num(1234)]);
|
||||
assert_eq!(Item::read_all("1234 5 67")?,
|
||||
vec![Num(1234), Num(5), Num(67)]);
|
||||
assert_eq!(Item::read_all("foo/bar")?,
|
||||
vec![Key("foo/bar".into())]);
|
||||
assert_eq!(Item::read_all(":symbol")?,
|
||||
vec![Sym(":symbol".into())]);
|
||||
assert_eq!(Item::read_all(" foo/bar :baz 456")?,
|
||||
vec![Key("foo/bar".into()), Sym(":baz".into()), Num(456)]);
|
||||
assert_eq!(Item::read_all(" (foo/bar :baz 456) ")?,
|
||||
vec![Exp(vec![Key("foo/bar".into()), Sym(":baz".into()), Num(456)])]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)] #[test] fn test_edn_layout () -> Result<(), ParseError> {
|
||||
let source = include_str!("example.edn");
|
||||
let layout = Item::read_all(source)?;
|
||||
panic!("{layout:?}");
|
||||
let content = EdnLayout::from(&layout);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ pub trait Output<E: Engine> {
|
|||
/// Mutable pointer to area
|
||||
fn area_mut (&mut self) -> &mut E::Area;
|
||||
/// Render widget in area
|
||||
fn place (&mut self, area: E::Area, content: &impl Content<E>);
|
||||
fn place (&mut self, area: E::Area, content: &impl Render<E>);
|
||||
|
||||
#[inline] fn x (&self) -> E::Unit { self.area().x() }
|
||||
#[inline] fn y (&self) -> E::Unit { self.area().y() }
|
||||
|
|
@ -17,19 +17,25 @@ pub trait Output<E: Engine> {
|
|||
#[inline] fn h (&self) -> E::Unit { self.area().h() }
|
||||
#[inline] fn wh (&self) -> E::Size { self.area().wh().into() }
|
||||
}
|
||||
|
||||
pub trait Content<E: Engine>: Send + Sync {
|
||||
fn content (&self) -> impl Content<E> {
|
||||
()
|
||||
}
|
||||
fn layout (&self, area: E::Area) -> E::Area {
|
||||
self.content().layout(area)
|
||||
}
|
||||
fn render (&self, output: &mut E::Output) {
|
||||
output.place(self.layout(output.area()), &self.content())
|
||||
}
|
||||
pub trait Render<E: Engine>: Send + Sync {
|
||||
fn layout (&self, area: E::Area) -> E::Area { area }
|
||||
fn render (&self, output: &mut E::Output) {}
|
||||
}
|
||||
impl<E: Engine, C: Content<E>> Render<E> for C {
|
||||
fn layout (&self, area: E::Area) -> E::Area { Content::layout(self, area) }
|
||||
fn render (&self, output: &mut E::Output) { Content::render(self, output) }
|
||||
}
|
||||
impl<E: Engine> Content<E> for Box<dyn Render<E>> {
|
||||
fn content (&self) -> impl Content<E> { self }
|
||||
}
|
||||
impl<E: Engine> Content<E> for &dyn Render<E> {
|
||||
fn content (&self) -> impl Content<E> { self }
|
||||
}
|
||||
pub trait Content<E: Engine>: Send + Sync + Sized {
|
||||
fn content (&self) -> impl Content<E> { () }
|
||||
fn layout (&self, area: E::Area) -> E::Area { area }
|
||||
fn render (&self, output: &mut E::Output) {}
|
||||
}
|
||||
|
||||
/// The platonic ideal unit of [Content]: total emptiness at dead center.
|
||||
impl<E: Engine> Content<E> for () {
|
||||
fn layout (&self, area: E::Area) -> E::Area {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct TuiOut {
|
|||
impl Output<Tui> for TuiOut {
|
||||
#[inline] fn area (&self) -> [u16;4] { self.area }
|
||||
#[inline] fn area_mut (&mut self) -> &mut [u16;4] { &mut self.area }
|
||||
#[inline] fn place (&mut self, area: [u16;4], content: &impl Content<Tui>) {
|
||||
#[inline] fn place (&mut self, area: [u16;4], content: &impl Render<Tui>) {
|
||||
let last = self.area();
|
||||
*self.area_mut() = area;
|
||||
content.render(self);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl<E: Engine, T: Content<E>> Content<E> for Align<T> {
|
|||
}
|
||||
fn layout (&self, on: E::Area) -> E::Area {
|
||||
use Alignment::*;
|
||||
let it = self.content().layout(on).xywh();
|
||||
let it = Render::layout(&self.content(), on).xywh();
|
||||
let centered = on.center_xy(it.wh());
|
||||
let far_x = (on.x() + on.w()).minus(it.w());
|
||||
let far_y = (on.y() + on.h()).minus(it.h());
|
||||
|
|
@ -47,6 +47,8 @@ impl<E: Engine, T: Content<E>> Content<E> for Align<T> {
|
|||
[x, y, centered.w(), centered.h()].into()
|
||||
}
|
||||
fn render (&self, render: &mut E::Output) {
|
||||
render.place(self.layout(render.area()), &self.content())
|
||||
let content = &self.content();
|
||||
let it = Render::layout(content, render.area()).xywh();
|
||||
render.place(it.into(), content)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::*;
|
|||
/// Show an item only when a condition is true.
|
||||
pub struct When<A>(pub bool, pub A);
|
||||
|
||||
impl<E: Engine, A: Content<E>> Content<E> for When<A> {
|
||||
impl<E: Engine, A: Render<E>> Content<E> for When<A> {
|
||||
fn layout (&self, to: E::Area) -> E::Area {
|
||||
let Self(cond, item) = self;
|
||||
let mut area = E::Area::zero();
|
||||
|
|
@ -25,7 +25,7 @@ impl<E: Engine, A: Content<E>> Content<E> for When<A> {
|
|||
/// Show one item if a condition is true and another if the condition is false
|
||||
pub struct Either<A, B>(pub bool, pub A, pub B);
|
||||
|
||||
impl<E: Engine, A: Content<E>, B: Content<E>> Content<E> for Either<A, B> {
|
||||
impl<E: Engine, A: Render<E>, B: Render<E>> Content<E> for Either<A, B> {
|
||||
fn layout (&self, to: E::Area) -> E::Area {
|
||||
let Self(cond, a, b) = self;
|
||||
if *cond { a.layout(to) } else { b.layout(to) }
|
||||
|
|
@ -43,7 +43,7 @@ pub struct Map<A, B, I, F, G>(pub F, pub G) where
|
|||
|
||||
impl<E, A, B, I, F, G> Content<E> for Map<A, B, I, F, G> where
|
||||
E: Engine,
|
||||
B: Content<E>,
|
||||
B: Render<E>,
|
||||
I: Iterator<Item = A> + Send + Sync,
|
||||
F: Fn() -> I + Send + Sync,
|
||||
G: Fn(A, usize)->B + Send + Sync
|
||||
|
|
@ -85,7 +85,7 @@ impl<E, A, B, I, F, G> Content<E> for Map<A, B, I, F, G> where
|
|||
//pub fn reduce <E, T, I, R, F>(iterator: I, callback: F) -> Reduce<E, T, I, R, F> where
|
||||
//E: Engine,
|
||||
//I: Iterator<Item = T> + Send + Sync,
|
||||
//R: Content<E>,
|
||||
//R: Render<E>,
|
||||
//F: Fn(R, T, usize) -> R + Send + Sync
|
||||
//{
|
||||
//Reduce(Default::default(), iterator, callback)
|
||||
|
|
@ -93,12 +93,12 @@ impl<E, A, B, I, F, G> Content<E> for Map<A, B, I, F, G> where
|
|||
pub struct Reduce<E, T, I, R, F>(PhantomData<(E, R)>, I, F) where
|
||||
E: Engine,
|
||||
I: Iterator<Item = T> + Send + Sync,
|
||||
R: Content<E>,
|
||||
R: Render<E>,
|
||||
F: Fn(R, T, usize) -> R + Send + Sync;
|
||||
impl<E, T, I, R, F> Content<E> for Reduce<E, T, I, R, F> where
|
||||
E: Engine,
|
||||
I: Iterator<Item = T> + Send + Sync,
|
||||
R: Content<E>,
|
||||
R: Render<E>,
|
||||
F: Fn(R, T, usize) -> R + Send + Sync
|
||||
{
|
||||
fn render (&self, to: &mut E::Output) {
|
||||
|
|
@ -132,16 +132,16 @@ impl<E, T, I, R, F> Content<E> for Reduce<E, T, I, R, F> where
|
|||
|
||||
//define_ops! {
|
||||
//Layout<E: Engine> {
|
||||
//(when <A: Content<E>,>
|
||||
//(when <A: Render<E>,>
|
||||
//When(cond: bool, item: A))
|
||||
///// When `cond` is `true`, render `a`, otherwise render `b`.
|
||||
//(either <A: Content<E>, B: Content<E>,>
|
||||
//(either <A: Render<E>, B: Render<E>,>
|
||||
//Either(cond: bool, a: A, b: B))
|
||||
///// If `opt` is `Some(T)` renders `cb(t)`, otherwise nothing.
|
||||
//(opt <A, F: Fn(A) -> B, B: Content<E>,>
|
||||
//(opt <A, F: Fn(A) -> B, B: Render<E>,>
|
||||
//Opt(option: Option<A>, cb: F))
|
||||
///// Maps items of iterator through callback.
|
||||
//(map <A, B: Content<E>, I: Iterator<Item = A>, F: Fn() -> I, G: Fn(A, usize)->B,>
|
||||
//(map <A, B: Render<E>, I: Iterator<Item = A>, F: Fn() -> I, G: Fn(A, usize)->B,>
|
||||
//Map(get_iterator: F, callback: G))
|
||||
//}
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ macro_rules! transform_xy_unit {
|
|||
}
|
||||
|
||||
transform_xy_unit!(|self: Fixed, area|{
|
||||
let [w, h] = self.content().layout(area.center_xy(match self {
|
||||
let [w, h] = Render::layout(&self.content(), area.center_xy(match self {
|
||||
Self::X(fw, _) => [*fw, area.h()],
|
||||
Self::Y(fh, _) => [area.w(), *fh],
|
||||
Self::XY(fw, fh, _) => [*fw, *fh],
|
||||
|
|
@ -54,16 +54,16 @@ transform_xy_unit!(|self: Fixed, area|{
|
|||
})
|
||||
});
|
||||
|
||||
transform_xy_unit!(|self: Shrink, area|self.content().layout([
|
||||
transform_xy_unit!(|self: Shrink, area|Render::layout(&self.content(), [
|
||||
area.x(), area.y(), area.w().minus(self.dx()), area.h().minus(self.dy())
|
||||
].into()));
|
||||
|
||||
transform_xy_unit!(|self: Expand, area|self.content().layout([
|
||||
transform_xy_unit!(|self: Expand, area|Render::layout(&self.content(), [
|
||||
area.x(), area.y(), area.w() + self.dx(), area.h() + self.dy()
|
||||
].into()));
|
||||
|
||||
transform_xy_unit!(|self: Min, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
match self {
|
||||
Self::X(mw, _) => [area.x(), area.y(), area.w().max(*mw), area.h()],
|
||||
Self::Y(mh, _) => [area.x(), area.y(), area.w(), area.h().max(*mh)],
|
||||
|
|
@ -71,31 +71,31 @@ transform_xy_unit!(|self: Min, area|{
|
|||
}});
|
||||
|
||||
transform_xy_unit!(|self: Max, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
match self {
|
||||
Self::X(mw, _) => [area.x(), area.y(), area.w().min(*mw), area.h()],
|
||||
Self::Y(mh, _) => [area.x(), area.y(), area.w(), area.h().min(*mh)],
|
||||
Self::XY(mw, mh, _) => [area.x(), area.y(), area.w().min(*mw), area.h().min(*mh)],
|
||||
}});
|
||||
|
||||
transform_xy_unit!(|self: Push, area|self.content().layout([
|
||||
transform_xy_unit!(|self: Push, area|Render::layout(&self.content(), [
|
||||
area.x() + self.dx(), area.y() + self.dy(), area.w(), area.h()
|
||||
].into()));
|
||||
|
||||
transform_xy_unit!(|self: Pull, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
[area.x().minus(self.dx()), area.y().minus(self.dy()), area.w(), area.h()]
|
||||
});
|
||||
|
||||
transform_xy_unit!(|self: Margin, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
let dx = self.dx();
|
||||
let dy = self.dy();
|
||||
[area.x().minus(dx), area.y().minus(dy), area.w() + dy + dy, area.h() + dy + dy]
|
||||
});
|
||||
|
||||
transform_xy_unit!(|self: Padding, area|{
|
||||
let area = self.content().layout(area);
|
||||
let area = Render::layout(&self.content(), area);
|
||||
let dx = self.dx();
|
||||
let dy = self.dy();
|
||||
[area.x() + dx, area.y() + dy, area.w().minus(dy + dy), area.h().minus(dy + dy), ]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
use crate::*;
|
||||
use super::*;
|
||||
use std::marker::ConstParamTy;
|
||||
render!(Tui: (self: Groovebox) => self.size.of(
|
||||
Bsp::s(self.toolbar_view(),
|
||||
Bsp::n(self.selector_view(),
|
||||
Bsp::n(self.sample_view(),
|
||||
Bsp::n(self.status_view(),
|
||||
Bsp::w(self.pool_view(), Fill::xy(Bsp::e(self.sampler_view(), &self.editor)))))))));
|
||||
|
||||
const GROOVEBOX_EDN: &'static str = include_str!("groovebox.edn");
|
||||
|
||||
|
|
@ -9,12 +15,6 @@ impl Content<Tui> for Groovebox {
|
|||
EdnView::parse(self.edn.as_slice())
|
||||
}
|
||||
}
|
||||
//render!(Tui: (self: Groovebox) => self.size.of(
|
||||
//Bsp::s(self.toolbar_view(),
|
||||
//Bsp::n(self.selector_view(),
|
||||
//Bsp::n(self.sample_view(),
|
||||
//Bsp::n(self.status_view(),
|
||||
//Bsp::w(self.pool_view(), Fill::xy(Bsp::e(self.sampler_view(), &self.editor)))))))));
|
||||
|
||||
macro_rules! edn_context {
|
||||
($Struct:ident |$l:lifetime, $state:ident| {
|
||||
|
|
@ -61,34 +61,39 @@ macro_rules! edn_context {
|
|||
}
|
||||
|
||||
edn_context!(Groovebox |'a, state| {
|
||||
":input-meter-l" = input_meter_l: Meter<'a> => Meter("L/", state.sampler.input_meter[0]),
|
||||
":input-meter-r" = input_meter_r: Meter<'a> => Meter("R/", state.sampler.input_meter[1]),
|
||||
|
||||
":transport" = transport: TransportView<'a> => TransportView::new(true, &state.player.clock),
|
||||
|
||||
":clip-play" = clip_play: ClipSelected => ClipSelected::play_phrase(&state.player),
|
||||
":clip-next" = clip_next: ClipSelected => ClipSelected::next_phrase(&state.player),
|
||||
":clip-edit" = clip_edit: MidiEditClip<'a> => MidiEditClip(&state.editor),
|
||||
|
||||
":edit-stat" = edit_stat: MidiEditStatus<'a> => MidiEditStatus(&state.editor),
|
||||
|
||||
":sample-h" = sample_h: u16 => if state.compact { 0 } else { 5 },
|
||||
":sample-view" = sample_view: SampleViewer => SampleViewer::from_sampler(
|
||||
&state.sampler, state.editor.note_point()),
|
||||
":sample-stat" = sample_stat: SamplerStatus<'a> => SamplerStatus(
|
||||
&state.sampler, state.editor.note_point()),
|
||||
|
||||
":input-meter-l" = input_meter_l: Meter<'a> =>
|
||||
Meter("L/", state.sampler.input_meter[0]),
|
||||
":input-meter-r" = input_meter_r: Meter<'a> =>
|
||||
Meter("R/", state.sampler.input_meter[1]),
|
||||
":transport" = transport: TransportView<'a> =>
|
||||
TransportView::new(true, &state.player.clock),
|
||||
":clip-play" = clip_play: ClipSelected =>
|
||||
ClipSelected::play_phrase(&state.player),
|
||||
":clip-next" = clip_next: ClipSelected =>
|
||||
ClipSelected::next_phrase(&state.player),
|
||||
":clip-edit" = clip_edit: MidiEditClip<'a> =>
|
||||
MidiEditClip(&state.editor),
|
||||
":edit-stat" = edit_stat: MidiEditStatus<'a> =>
|
||||
MidiEditStatus(&state.editor),
|
||||
":sample-h" = sample_h: u16 =>
|
||||
if state.compact { 0 } else { 5 },
|
||||
":sample-view" = sample_view: SampleViewer =>
|
||||
SampleViewer::from_sampler(&state.sampler, state.editor.note_point()),
|
||||
":sample-stat" = sample_stat: SamplerStatus<'a> =>
|
||||
SamplerStatus(&state.sampler, state.editor.note_point()),
|
||||
":pool-w" = pool_w: u16 => if state.compact { 5 } else {
|
||||
let w = state.size.w();
|
||||
if w > 60 { 20 } else if w > 40 { 15 } else { 10 } },
|
||||
":pool-view" = pool_view: PoolView<'a> => PoolView(state.compact, &state.pool),
|
||||
|
||||
":samples-w" = samples_w: u16 => if state.compact { 4 } else { 11 },
|
||||
":samples-y" = samples_y: u16 => if state.compact { 1 } else { 0 },
|
||||
":pool-view" = pool_view: PoolView<'a> =>
|
||||
PoolView(state.compact, &state.pool),
|
||||
":samples-w" = samples_w: u16 =>
|
||||
if state.compact { 4 } else { 11 },
|
||||
":samples-y" = samples_y: u16 =>
|
||||
if state.compact { 1 } else { 0 },
|
||||
":samples-view" = samples_view: SampleList<'a> => SampleList::new(
|
||||
state.compact, &state.sampler, &state.editor),
|
||||
|
||||
":midi-view" = midi_view: &'a MidiEditor => &state.editor,
|
||||
":midi-view" = midi_view: &'a MidiEditor =>
|
||||
&state.editor,
|
||||
});
|
||||
|
||||
//impl Groovebox {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue