Skip to main content

Registry

Struct Registry 

Source
pub struct Registry { /* private fields */ }

Implementations§

Source§

impl Registry

Source

pub fn new() -> Self

Source

pub fn register<A, F, Fut>(&mut self, name: &str, entry: F) -> &mut Self
where A: Actor, F: Fn(Start<A>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

👎Deprecated:

use register_actor/register_actor_with and implement Actor + Handles instead

Source

pub fn register_actor<A>(&mut self, name: &str) -> &mut Self
where A: Actor,

Source

pub fn register_actor_with<A>( &mut self, name: &str, config: ActorConfig, ) -> &mut Self
where A: Actor,

Source

pub fn register_with<A, F, Fut>( &mut self, name: &str, config: ActorConfig, entry: F, ) -> &mut Self
where A: Actor, F: Fn(Start<A>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

👎Deprecated:

use register_actor/register_actor_with and implement Actor + Handles instead

Source

pub async fn serve(self, shutdown: CancellationToken) -> Result<()>

Source

pub async fn serve_with_config( self, config: ServeConfig, shutdown: CancellationToken, ) -> Result<()>

Source

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.

Source

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.

Source

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.

Source

pub async fn start_with_config(self, config: ServeConfig) -> Result<()>

start with an explicit ServeConfig.

Trait Implementations§

Source§

impl Default for Registry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> RuntimeFutureOutput for T
where T: Send + 'static,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more