chore: Add redvault_el_rs emacs integration
This commit is contained in:
parent
734a6300a1
commit
1e0ca489fa
6 changed files with 196 additions and 5 deletions
143
Cargo.lock
generated
143
Cargo.lock
generated
|
@ -1442,6 +1442,16 @@ dependencies = [
|
|||
"syn 2.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor"
|
||||
version = "0.1.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctor-lite"
|
||||
version = "0.1.0"
|
||||
|
@ -1484,6 +1494,16 @@ dependencies = [
|
|||
"zbus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858"
|
||||
dependencies = [
|
||||
"darling_core 0.10.2",
|
||||
"darling_macro 0.10.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.14.4"
|
||||
|
@ -1504,6 +1524,20 @@ dependencies = [
|
|||
"darling_macro 0.20.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim 0.9.3",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.14.4"
|
||||
|
@ -1532,6 +1566,17 @@ dependencies = [
|
|||
"syn 2.0.77",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||
dependencies = [
|
||||
"darling_core 0.10.2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.14.4"
|
||||
|
@ -1659,7 +1704,7 @@ dependencies = [
|
|||
"convert_case 0.4.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustc_version",
|
||||
"rustc_version 0.4.1",
|
||||
"syn 2.0.77",
|
||||
]
|
||||
|
||||
|
@ -1866,6 +1911,50 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "emacs"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a773f2eeb842fea9f9e52f8360dbf7c0c54af0c904e025c9e08db5053b8718c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ctor",
|
||||
"emacs-macros",
|
||||
"emacs_module",
|
||||
"once_cell",
|
||||
"rustc_version 0.2.3",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "emacs-macros"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69656fdfe7c2608b87164964db848b5c3795de7302e3130cce7131552c6be161"
|
||||
dependencies = [
|
||||
"darling 0.10.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "emacs-rs-module"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e405af72204dd111e327e34e88e1a4de0fef2fb5a82c4502e29c1ad5092490c4"
|
||||
dependencies = [
|
||||
"emacs",
|
||||
"lazy_static",
|
||||
"libloading 0.5.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "emacs_module"
|
||||
version = "0.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3067bc974045ed2c6db333bd4fc30d3bdaafa6421a9a889fa7b2826b6f7f2fa"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.34"
|
||||
|
@ -2020,7 +2109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"rustc_version",
|
||||
"rustc_version 0.4.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4028,6 +4117,16 @@ version = "0.2.158"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.4"
|
||||
|
@ -6043,6 +6142,14 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redvault_el_rs"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"emacs",
|
||||
"emacs-rs-module",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.6"
|
||||
|
@ -6378,13 +6485,22 @@ version = "2.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
dependencies = [
|
||||
"semver 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver",
|
||||
"semver 1.0.23",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -6608,12 +6724,27 @@ version = "1.0.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
dependencies = [
|
||||
"semver-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "send_wrapper"
|
||||
version = "0.6.0"
|
||||
|
@ -7425,6 +7556,12 @@ dependencies = [
|
|||
"unicode-properties",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
|
|
|
@ -27,7 +27,7 @@ lto = "fat"
|
|||
panic = "abort"
|
||||
|
||||
[workspace]
|
||||
members = ["llama_forge_rs", "leptos_stub", "frozen_llama", "llama_proxy_man"]
|
||||
members = ["llama_forge_rs", "leptos_stub", "frozen_llama", "llama_proxy_man", "redvault_el_rs"]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
|
|
|
@ -339,7 +339,7 @@ async fn handle_request(
|
|||
|
||||
let body = axum::body::Body::from_stream(byte_stream);
|
||||
|
||||
tracing::info!("streaming response on port: {}", model_config.port);
|
||||
tracing::debug!("streaming response on port: {}", model_config.port);
|
||||
let response = builder.body(body)?;
|
||||
Ok::<axum::http::Response<Body>, AppError>(response)
|
||||
}
|
||||
|
|
22
redvault_el_rs/Cargo.toml
Normal file
22
redvault_el_rs/Cargo.toml
Normal file
|
@ -0,0 +1,22 @@
|
|||
[package]
|
||||
name = "redvault_el_rs"
|
||||
authors.workspace = true
|
||||
description.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
readme.workspace = true
|
||||
repository.workspace = true
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
emacs = "0.19"
|
||||
emacs-rs-module = { version = "0.19.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
emacs-rs-module = { version = "0.19.0" }
|
||||
[build-dependencies]
|
||||
emacs-rs-module = { version = "0.19.0" }
|
14
redvault_el_rs/README.md
Normal file
14
redvault_el_rs/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# emacs module foo
|
||||
|
||||
## Hot reload for dev
|
||||
```elisp
|
||||
(module-load "/media/SanDisk/ai/tools/redvault-ai/target/release/deps/libemacs_rs_module-9ad53dadcc38727d.so")
|
||||
|
||||
|
||||
(defun hotreload-el-rs ()
|
||||
(interactive)
|
||||
(rs-module/load "/media/SanDisk/ai/tools/redvault-ai/target/debug/libredvault_el_rs.so")
|
||||
(redvault-el-rs/say-hello "Asd"))
|
||||
```
|
||||
|
||||
|
18
redvault_el_rs/src/lib.rs
Normal file
18
redvault_el_rs/src/lib.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
use emacs::{defun, Env, Result, Value};
|
||||
|
||||
// Emacs won't load the module without this.
|
||||
emacs::plugin_is_GPL_compatible!();
|
||||
|
||||
// Register the initialization hook that Emacs will call when it loads the module.
|
||||
#[emacs::module(separator = "/")]
|
||||
fn init(env: &Env) -> Result<Value<'_>> {
|
||||
env.message("Test loading!");
|
||||
|
||||
env.message("Done loading!")
|
||||
}
|
||||
|
||||
// Define a function callable by Lisp code.
|
||||
#[defun]
|
||||
fn say_hello(env: &Env, name: String) -> Result<Value<'_>> {
|
||||
env.message(&format!("Helloo Broooooooo, {}!", name))
|
||||
}
|
Loading…
Add table
Reference in a new issue