systemprompt_models/execution/context/
call_source.rs1use serde::{Deserialize, Serialize};
4use std::str::FromStr;
5
6use crate::errors::ParseEnumError;
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "lowercase")]
10pub enum CallSource {
11 Agentic,
12 Direct,
13 Ephemeral,
14}
15
16impl FromStr for CallSource {
17 type Err = ParseEnumError;
18
19 fn from_str(s: &str) -> Result<Self, Self::Err> {
20 match s.to_lowercase().as_str() {
21 "agentic" => Ok(Self::Agentic),
22 "direct" => Ok(Self::Direct),
23 "ephemeral" => Ok(Self::Ephemeral),
24 _ => Err(ParseEnumError::new("call_source", s)),
25 }
26 }
27}
28
29impl CallSource {
30 pub const fn as_str(&self) -> &'static str {
31 match self {
32 Self::Agentic => "agentic",
33 Self::Direct => "direct",
34 Self::Ephemeral => "ephemeral",
35 }
36 }
37}