Skip to main content

rune_framework/
lib.rs

1//! Rune SDK for Rust — Caster client library.
2//!
3//! Connect to a Rune Runtime, register handlers, and serve requests.
4//!
5//! # Example
6//! ```rust,no_run
7//! use rune_framework::{Caster, CasterConfig, RuneConfig, RuneContext};
8//! use bytes::Bytes;
9//!
10//! #[tokio::main]
11//! async fn main() {
12//!     let caster = Caster::new(CasterConfig::default());
13//!
14//!     caster.rune(
15//!         RuneConfig::new("echo"),
16//!         |_ctx: RuneContext, input: Bytes| async move { Ok(input) },
17//!     ).unwrap();
18//!
19//!     caster.run().await.unwrap();
20//! }
21//! ```
22
23pub mod proto {
24    pub mod rune {
25        pub mod wire {
26            pub mod v1 {
27                tonic::include_proto!("rune.wire.v1");
28            }
29        }
30    }
31    pub use rune::wire::v1::*;
32}
33
34pub mod caster;
35pub mod config;
36pub mod context;
37pub mod error;
38pub mod handler;
39pub mod stream;
40
41// Re-exports for convenience
42pub use caster::Caster;
43pub use config::{CasterConfig, FileAttachment, GateConfig, RuneConfig};
44pub use context::RuneContext;
45pub use error::{SdkError, SdkResult};
46pub use handler::{HandlerKind, RegisteredRune};
47pub use stream::StreamSender;