pub enum CodeLanguage {
GraphQL,
JavaScript,
Sql,
Mcp,
}Expand description
Supported code languages for validation and execution.
Each variant selects a different validation path in the pipeline and
maps to the corresponding feature flag. The derive macro mirrors these
variants in gen_validation_call() (proc-macro crates cannot depend on
runtime crates, so the string matching is duplicated by necessity).
A sync test in the derive crate enforces both sides stay aligned.
§Adding a New Language
- Add a variant here with
from_attr/as_str/required_featurearms - Add the validation method to
ValidationPipeline(feature-gated) - Add the
quote!branch inpmcp-code-mode-derive/src/lib.rsgen_validation_call() - Update
CodeModeToolBuilderfor tool metadata - Add the new string to the sync test in the derive crate
Variants§
GraphQL
GraphQL queries and mutations. Default, no feature flag required.
JavaScript
JavaScript/OpenAPI plans. Requires openapi-code-mode feature.
Sql
Raw SQL statements. Requires sql-code-mode feature.
Mcp
MCP tool composition. Requires mcp-code-mode feature.
Implementations§
Source§impl CodeLanguage
impl CodeLanguage
Sourcepub fn from_attr(s: &str) -> Option<Self>
pub fn from_attr(s: &str) -> Option<Self>
Parse a language string from a derive macro attribute.
Returns None for unrecognized values — the caller should emit
a compile error listing supported values.
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
The string value used in tool metadata and serde serialization.
Sourcepub fn required_feature(&self) -> Option<&'static str>
pub fn required_feature(&self) -> Option<&'static str>
The feature flag required by this language, if any.
Trait Implementations§
Source§impl Clone for CodeLanguage
impl Clone for CodeLanguage
Source§fn clone(&self) -> CodeLanguage
fn clone(&self) -> CodeLanguage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodeLanguage
impl Debug for CodeLanguage
Source§impl<'de> Deserialize<'de> for CodeLanguage
impl<'de> Deserialize<'de> for CodeLanguage
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>,
Source§impl Display for CodeLanguage
impl Display for CodeLanguage
Source§impl PartialEq for CodeLanguage
impl PartialEq for CodeLanguage
Source§impl Serialize for CodeLanguage
impl Serialize for CodeLanguage
impl Copy for CodeLanguage
impl Eq for CodeLanguage
impl StructuralPartialEq for CodeLanguage
Auto Trait Implementations§
impl Freeze for CodeLanguage
impl RefUnwindSafe for CodeLanguage
impl Send for CodeLanguage
impl Sync for CodeLanguage
impl Unpin for CodeLanguage
impl UnsafeUnpin for CodeLanguage
impl UnwindSafe for CodeLanguage
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more