pub struct DslEngine { /* private fields */ }Expand description
DSL Engine - loads and executes action type definitions
Implementations§
Source§impl DslEngine
impl DslEngine
Sourcepub fn load_definition_from_file(
&mut self,
path: impl AsRef<Path>,
) -> ClResult<()>
pub fn load_definition_from_file( &mut self, path: impl AsRef<Path>, ) -> ClResult<()>
Load action definition from JSON file
Sourcepub fn load_definition_from_json(&mut self, json: &str) -> ClResult<()>
pub fn load_definition_from_json(&mut self, json: &str) -> ClResult<()>
Load action definition from JSON string
Sourcepub fn load_definition(&mut self, definition: ActionDefinition)
pub fn load_definition(&mut self, definition: ActionDefinition)
Load action definition directly
Sourcepub fn load_definitions_from_dir(
&mut self,
dir: impl AsRef<Path>,
) -> ClResult<usize>
pub fn load_definitions_from_dir( &mut self, dir: impl AsRef<Path>, ) -> ClResult<usize>
Load all definitions from a directory
Sourcepub fn get_definition(&self, action_type: &str) -> Option<&ActionDefinition>
pub fn get_definition(&self, action_type: &str) -> Option<&ActionDefinition>
Get action definition
Sourcepub fn has_definition(&self, action_type: &str) -> bool
pub fn has_definition(&self, action_type: &str) -> bool
Check if action type has DSL definition
Sourcepub fn resolve_action_type(
&self,
typ: &str,
sub_typ: Option<&str>,
) -> Option<String>
pub fn resolve_action_type( &self, typ: &str, sub_typ: Option<&str>, ) -> Option<String>
Resolve action type for hook lookup. Tries full type (typ:sub_typ) first, then falls back to base type.
Sourcepub async fn execute_hook(
&self,
app: &App,
action_type: &str,
hook_type: HookType,
context: HookContext,
) -> ClResult<()>
pub async fn execute_hook( &self, app: &App, action_type: &str, hook_type: HookType, context: HookContext, ) -> ClResult<()>
Execute a hook for an action type
Sourcepub async fn execute_hook_with_result(
&self,
app: &App,
action_type: &str,
hook_type: HookType,
context: HookContext,
) -> ClResult<HookResult>
pub async fn execute_hook_with_result( &self, app: &App, action_type: &str, hook_type: HookType, context: HookContext, ) -> ClResult<HookResult>
Execute a hook for an action type and return the HookResult This is useful for synchronous endpoints that need to return the hook’s response
Sourcepub fn get_behavior(&self, action_type: &str) -> Option<&BehaviorFlags>
pub fn get_behavior(&self, action_type: &str) -> Option<&BehaviorFlags>
Get behavior flags for an action type
Sourcepub fn get_field_constraints(
&self,
action_type: &str,
) -> Option<&FieldConstraints>
pub fn get_field_constraints( &self, action_type: &str, ) -> Option<&FieldConstraints>
Get field constraints for an action type
Sourcepub fn get_key_pattern(&self, action_type: &str) -> Option<&str>
pub fn get_key_pattern(&self, action_type: &str) -> Option<&str>
Get key pattern for an action type
Sourcepub fn validate_content(
&self,
action_type: &str,
content: Option<&Value>,
) -> ClResult<()>
pub fn validate_content( &self, action_type: &str, content: Option<&Value>, ) -> ClResult<()>
Validate action content against the schema defined for an action type.
Returns Ok(()) if content is valid or no schema is defined. Returns Err with validation details if content violates the schema.
Sourcepub fn list_action_types(&self) -> Vec<String>
pub fn list_action_types(&self) -> Vec<String>
List all loaded action types
Sourcepub fn stats(&self) -> DslEngineStats
pub fn stats(&self) -> DslEngineStats
Get statistics about loaded definitions
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DslEngine
impl !RefUnwindSafe for DslEngine
impl Send for DslEngine
impl Sync for DslEngine
impl Unpin for DslEngine
impl UnsafeUnpin for DslEngine
impl !UnwindSafe for DslEngine
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().