pub struct AlloraRuntime { /* private fields */ }Expand description
Aggregated runtime container for all built components (channels today, more later).
Prefer borrowing via the accessor methods (channels(), channel_by_id) for read-only
operations. Use into_channels() only when you need ownership transfer (e.g. embedding
channels into another structure or performing manual lifecycle management).
Implementations§
Source§impl AlloraRuntime
impl AlloraRuntime
Sourcepub fn new(channels: Vec<Box<dyn Channel>>) -> Self
pub fn new(channels: Vec<Box<dyn Channel>>) -> Self
Create a new runtime instance from a vector of channels.
Typically, invoked internally by the DSL (build_runtime_from_str).
Sourcepub fn with_filters(self, filters: Vec<Filter>) -> Self
pub fn with_filters(self, filters: Vec<Filter>) -> Self
Sets the filters for this runtime.
Consumes the provided filters vector and assigns it to the runtime.
Sourcepub fn with_services(self, services: Vec<ServiceProcessor>) -> Self
pub fn with_services(self, services: Vec<ServiceProcessor>) -> Self
Sets the services for this runtime.
Consumes the provided services vector and assigns it to the runtime.
pub fn with_service_processors( self, proc: Vec<ServiceActivatorProcessor>, ) -> Self
Sourcepub fn with_http_inbound_adapters(
self,
adapters: Vec<HttpInboundAdapter>,
) -> Self
pub fn with_http_inbound_adapters( self, adapters: Vec<HttpInboundAdapter>, ) -> Self
Sets the HTTP inbound adapters for this runtime.
Consumes the provided adapters vector and assigns it to the runtime.
pub fn with_http_outbound_adapters( self, adapters: Vec<HttpOutboundAdapter>, ) -> Self
Sourcepub fn channels(&self) -> impl Iterator<Item = &dyn Channel>
pub fn channels(&self) -> impl Iterator<Item = &dyn Channel>
Borrow all channels as an iterator of &dyn Channel (zero allocation).
Sourcepub fn channels_slice(&self) -> &[Arc<dyn Channel>]
pub fn channels_slice(&self) -> &[Arc<dyn Channel>]
Borrow underlying boxed channel slice (rarely needed).
Sourcepub fn services(&self) -> &[ServiceProcessor] ⓘ
pub fn services(&self) -> &[ServiceProcessor] ⓘ
Borrow all services (read-only slice).
Sourcepub fn into_channels(self) -> Vec<Arc<dyn Channel>>
pub fn into_channels(self) -> Vec<Arc<dyn Channel>>
Consume the runtime, yielding owned channels.
Sourcepub fn into_filters(self) -> Vec<Filter>
pub fn into_filters(self) -> Vec<Filter>
Consume the runtime, yielding owned filters.
Sourcepub fn into_services(self) -> Vec<ServiceProcessor> ⓘ
pub fn into_services(self) -> Vec<ServiceProcessor> ⓘ
Consume the runtime, yielding owned services.
Sourcepub fn channel_by_id(&self, id: &str) -> Option<&dyn Channel>
pub fn channel_by_id(&self, id: &str) -> Option<&dyn Channel>
Find a channel by its id; returns None if not present.
Complexity: O(n). Optimizations (hash index) can be added later without changing this method’s signature or semantics.
Sourcepub fn channel_ref_by_id(&self, id: &str) -> Option<Arc<dyn Channel>>
pub fn channel_ref_by_id(&self, id: &str) -> Option<Arc<dyn Channel>>
Return a cloned Arc
Sourcepub fn channel_typed<T: Channel + 'static>(&self, id: &str) -> Option<&T>
pub fn channel_typed<T: Channel + 'static>(&self, id: &str) -> Option<&T>
Generic typed channel lookup: returns &T if a channel with id exists and downcasts to T.
Sourcepub fn channel<T: Channel + 'static>(&self, id: &str) -> &T
pub fn channel<T: Channel + 'static>(&self, id: &str) -> &T
Required typed channel lookup: panics with a clear message if missing or wrong type.
Sourcepub fn channel_is<T: Channel + 'static>(&self, id: &str) -> bool
pub fn channel_is<T: Channel + 'static>(&self, id: &str) -> bool
Predicate: does channel id exist and is of type T?
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Total number of channels in this runtime.
Sourcepub fn filter_count(&self) -> usize
pub fn filter_count(&self) -> usize
Total number of filters in this runtime.
Sourcepub fn service_count(&self) -> usize
pub fn service_count(&self) -> usize
Total number of services in this runtime.
Sourcepub fn service_processor_count(&self) -> usize
pub fn service_processor_count(&self) -> usize
Total number of service processors in this runtime.