Skip to main content

APCore

Struct APCore 

Source
pub struct APCore {
    pub config: Config,
    /* private fields */
}
Expand description

Main entry point for interacting with the APCore system.

Fields§

§config: Config

Implementations§

Source§

impl APCore

Source

pub fn new() -> APCore

Create a new APCore client with default configuration.

Source

pub fn with_options( registry: Option<Registry>, executor: Option<Executor>, config: Option<Config>, metrics_collector: Option<MetricsCollector>, ) -> APCore

Create a new APCore client with all optional parameters.

If both executor and registry are provided, the executor takes precedence and the registry is ignored (the executor already contains its own registry).

Source

pub fn with_config(config: Config) -> APCore

Create a new APCore client with the given configuration.

Source

pub async fn call( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Value, ModuleError>

Call (execute) a module by ID with the given inputs.

Source

pub async fn call_async( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Value, ModuleError>

Alias for call() — provided for spec compatibility.

Source

pub async fn validate( &self, module_id: &str, inputs: &Value, ) -> Result<(), ModuleError>

Validate module inputs without executing.

Source

pub fn register( &mut self, module_id: &str, module: Box<dyn Module>, ) -> Result<(), ModuleError>

Register a module with the given module_id.

Source

pub async fn discover(&mut self) -> Result<usize, ModuleError>

Trigger module discovery.

Source

pub fn list_modules( &self, tags: Option<&[String]>, prefix: Option<&str>, ) -> Vec<String>

List all registered modules, optionally filtered by tags and/or prefix.

Source

pub fn use_middleware(&mut self, middleware: Box<dyn Middleware>)

Add a middleware to the execution pipeline.

Source

pub fn remove(&mut self, name: &str) -> bool

Remove a middleware by name.

Source

pub fn remove_middleware(&mut self, name: &str) -> bool

Remove a middleware by name (legacy alias).

Source

pub fn registry(&self) -> &Registry

Get a reference to the registry.

Source

pub fn executor(&self) -> &Executor

Get a reference to the executor.

Source

pub fn disable( &mut self, _module_id: &str, _reason: Option<&str>, ) -> Result<(), ModuleError>

Disable a module with an optional reason.

Source

pub fn enable( &mut self, _module_id: &str, _reason: Option<&str>, ) -> Result<(), ModuleError>

Re-enable a previously disabled module.

Source

pub fn on( &mut self, _event_type: &str, subscriber: Box<dyn EventSubscriber>, ) -> String

Subscribe to an event type. Returns the subscriber ID.

Lazily initializes the event emitter on first use.

Source

pub fn off(&mut self, subscriber_id: &str) -> bool

Unsubscribe by subscriber ID.

Source

pub fn events(&self) -> Option<&EventEmitter>

Get the event emitter, if configured.

Source

pub async fn reload(&mut self) -> Result<(), ModuleError>

Reload modules from the configured modules path.

Source

pub async fn shutdown(&mut self) -> Result<(), ModuleError>

Shut down the client and release resources.

Source

pub async fn stream( &self, module_id: &str, inputs: Value, ctx: Option<&Context<Value>>, version_hint: Option<&str>, ) -> Result<Vec<Value>, ModuleError>

Stream execution of a module.

Source

pub fn describe(&self, module_id: &str) -> String

Describe a module by ID.

Source

pub fn use_before(&mut self, middleware: Box<dyn BeforeMiddleware>)

Add a before callback middleware.

Source

pub fn use_after(&mut self, middleware: Box<dyn AfterMiddleware>)

Add an after callback middleware.

Trait Implementations§

Source§

impl Debug for APCore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for APCore

Source§

fn default() -> APCore

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

Auto Trait Implementations§

§

impl !Freeze for APCore

§

impl !RefUnwindSafe for APCore

§

impl Send for APCore

§

impl Sync for APCore

§

impl Unpin for APCore

§

impl UnsafeUnpin for APCore

§

impl !UnwindSafe for APCore

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> 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> 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
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,