pub struct Registry { /* private fields */ }Implementations§
Source§impl Registry
impl Registry
pub fn new() -> Self
pub fn register<A, F, Fut>(&mut self, name: &str, entry: F) -> &mut Self
use register_actor/register_actor_with and implement Actor + Handles instead
pub fn register_actor<A>(&mut self, name: &str) -> &mut Selfwhere
A: Actor,
pub fn register_actor_with<A>(
&mut self,
name: &str,
config: ActorConfig,
) -> &mut Selfwhere
A: Actor,
pub fn register_with<A, F, Fut>( &mut self, name: &str, config: ActorConfig, entry: F, ) -> &mut Self
use register_actor/register_actor_with and implement Actor + Handles instead
pub async fn serve(self, shutdown: CancellationToken) -> Result<()>
pub async fn serve_with_config( self, config: ServeConfig, shutdown: CancellationToken, ) -> Result<()>
Sourcepub async fn into_serverless_runtime(
self,
config: ServeConfig,
) -> Result<CoreServerlessRuntime>
pub async fn into_serverless_runtime( self, config: ServeConfig, ) -> Result<CoreServerlessRuntime>
Converts the registry into a serverless runtime. The returned runtime
lazily starts an envoy on first request and handles RivetKit serverless
HTTP requests (start, metadata, health, metrics) via
CoreServerlessRuntime::handle_request. Equivalent to the TypeScript
registry.handler entry point for platform fetch handlers.
Sourcepub fn prometheus_metrics(&self) -> Result<RenderedMetrics>
pub fn prometheus_metrics(&self) -> Result<RenderedMetrics>
Renders the process-global Prometheus metrics. Equivalent to the
TypeScript registry.routes.prometheusMetrics(). Metrics are
process-global, so this does not depend on registry instance state.
Sourcepub async fn start(self) -> Result<()>
pub async fn start(self) -> Result<()>
Serves actors until the process receives SIGINT or SIGTERM, then cancels
and drains. This is the standalone-binary entry point and mirrors the
TypeScript registry.start(). Connection settings (including the
RIVET_ENGINE_BINARY_PATH used to spawn or reuse a local engine) are
read from the environment.
Unlike TypeScript, this blocks until shutdown because Rust has no
implicit runtime to keep the process alive. For programmatic lifecycle
control (tests, embedding), drive serve with your own
CancellationToken instead.
Sourcepub async fn start_with_config(self, config: ServeConfig) -> Result<()>
pub async fn start_with_config(self, config: ServeConfig) -> Result<()>
start with an explicit ServeConfig.