pub struct PipelineDefinition {
pub services: Vec<ServiceDecl>,
pub nodes: Vec<NodeDecl>,
}Expand description
Top-level pipeline definition
Parsed from a TOML document. Use PipelineParser::from_str or
PipelineParser::from_file to obtain an instance, then call
PipelineDefinition::validate to check structural correctness.
Fields§
§services: Vec<ServiceDecl>Service adapter declarations
nodes: Vec<NodeDecl>Node declarations that form the DAG
Implementations§
Source§impl PipelineDefinition
impl PipelineDefinition
Sourcepub fn validate(&self) -> Result<(), PipelineError>
pub fn validate(&self) -> Result<(), PipelineError>
Validate the pipeline definition.
Checks:
- All node
servicereferences exist inservices(or known external names). - All
depends_onentries refer to existing nodes. - The dependency graph is acyclic.
§Example
use stygian_graph::application::pipeline_parser::PipelineParser;
let toml = r#"
[[nodes]]
name = "a"
service = "http"
[[nodes]]
name = "b"
service = "http"
depends_on = ["a"]
"#;
let def = PipelineParser::from_str(toml).unwrap();
assert!(def.validate().is_ok());Sourcepub fn validate_against_registry<S: AsRef<str>>(
&self,
registered_services: &[S],
) -> Result<(), PipelineError>
pub fn validate_against_registry<S: AsRef<str>>( &self, registered_services: &[S], ) -> Result<(), PipelineError>
Validate that all referenced services exist in the given registry names.
Useful for runtime validation after the registry has been populated.
§Example
use stygian_graph::application::pipeline_parser::PipelineParser;
let toml = r#"
[[nodes]]
name = "fetch"
service = "http"
"#;
let def = PipelineParser::from_str(toml).unwrap();
let registered = vec!["http".to_string(), "claude".to_string()];
assert!(def.validate_against_registry(®istered).is_ok());Sourcepub fn expand_templates(&mut self)
pub fn expand_templates(&mut self)
Expand template variables in string values across all nodes and services.
Supports:
${env:VAR_NAME}— replaced withstd::env::var("VAR_NAME")or left as-is
Modifies the definition in-place and returns self for chaining.
§Example
use stygian_graph::application::pipeline_parser::PipelineParser;
// Use HOME which is always available on Unix
let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string());
let toml = format!(r#"
[[nodes]]
name = "fetch"
service = "http"
url = "${{env:HOME}}"
"#);
let mut def = PipelineParser::from_str(&toml).unwrap();
def.expand_templates();
assert_eq!(def.nodes[0].url.as_deref(), Some(home.as_str()));Sourcepub fn topological_order(&self) -> Result<Vec<String>, PipelineError>
pub fn topological_order(&self) -> Result<Vec<String>, PipelineError>
Compute a topological ordering of the nodes (dependencies first).
Returns Err if the graph contains a cycle.
§Example
use stygian_graph::application::pipeline_parser::PipelineParser;
let toml = r#"
[[nodes]]
name = "c"
service = "http"
depends_on = ["b"]
[[nodes]]
name = "a"
service = "http"
[[nodes]]
name = "b"
service = "http"
depends_on = ["a"]
"#;
let def = PipelineParser::from_str(toml).unwrap();
let order = def.topological_order().unwrap();
assert_eq!(order[0], "a");
assert_eq!(order[2], "c");Sourcepub fn to_dot(&self) -> String
pub fn to_dot(&self) -> String
Export the pipeline DAG as a Graphviz DOT string.
§Example
use stygian_graph::application::pipeline_parser::PipelineParser;
let toml = r#"
[[nodes]]
name = "a"
service = "http"
[[nodes]]
name = "b"
service = "http"
depends_on = ["a"]
"#;
let def = PipelineParser::from_str(toml).unwrap();
let dot = def.to_dot();
assert!(dot.contains("digraph"));
assert!(dot.contains(r#""a" -> "b""#));Sourcepub fn to_mermaid(&self) -> String
pub fn to_mermaid(&self) -> String
Export the pipeline DAG as a Mermaid flowchart string.
§Example
use stygian_graph::application::pipeline_parser::PipelineParser;
let toml = r#"
[[nodes]]
name = "fetch"
service = "http"
[[nodes]]
name = "parse"
service = "claude"
depends_on = ["fetch"]
"#;
let def = PipelineParser::from_str(toml).unwrap();
let mermaid = def.to_mermaid();
assert!(mermaid.contains("flowchart LR"));
assert!(mermaid.contains("fetch --> parse"));Trait Implementations§
Source§impl Clone for PipelineDefinition
impl Clone for PipelineDefinition
Source§fn clone(&self) -> PipelineDefinition
fn clone(&self) -> PipelineDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PipelineDefinition
impl Debug for PipelineDefinition
Source§impl Default for PipelineDefinition
impl Default for PipelineDefinition
Source§fn default() -> PipelineDefinition
fn default() -> PipelineDefinition
Source§impl<'de> Deserialize<'de> for PipelineDefinition
impl<'de> Deserialize<'de> for PipelineDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PipelineDefinition
impl RefUnwindSafe for PipelineDefinition
impl Send for PipelineDefinition
impl Sync for PipelineDefinition
impl Unpin for PipelineDefinition
impl UnsafeUnpin for PipelineDefinition
impl UnwindSafe for PipelineDefinition
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);