#[non_exhaustive]pub enum CodeExecutionLanguage {
Python,
Unknown {
language_type: String,
data: Value,
},
}Expand description
Programming language for code execution.
This enum represents the programming language used in code execution requests. Currently only Python is supported by the Gemini API.
§Forward Compatibility (Evergreen Philosophy)
This enum is marked #[non_exhaustive], which means:
- Match statements must include a wildcard arm (
_ => ...) - New variants may be added in minor version updates without breaking your code
When the API returns a language value that this library doesn’t recognize,
it will be captured as CodeExecutionLanguage::Unknown rather than causing a
deserialization error. This follows the
Evergreen spec
philosophy of graceful degradation.
§Example
if let Content::CodeExecutionCall { language, code, .. } = content {
match language {
CodeExecutionLanguage::Python => println!("Python code: {}", code),
CodeExecutionLanguage::Unknown { language_type, .. } => {
println!("Unknown language '{}': {}", language_type, code);
}
_ => println!("Other language: {}", code),
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Python
Python programming language
Unknown
Unknown language (for forward compatibility).
This variant captures any unrecognized language values from the API, allowing the library to handle new languages gracefully.
The language_type field contains the unrecognized language string,
and data contains the full JSON value for debugging.
Implementations§
Source§impl CodeExecutionLanguage
impl CodeExecutionLanguage
Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Check if this is an unknown language.
Sourcepub fn unknown_language_type(&self) -> Option<&str>
pub fn unknown_language_type(&self) -> Option<&str>
Returns the language type name if this is an unknown language.
Returns None for known languages.
Sourcepub fn unknown_data(&self) -> Option<&Value>
pub fn unknown_data(&self) -> Option<&Value>
Returns the raw JSON data if this is an unknown language.
Returns None for known languages.
Trait Implementations§
Source§impl Clone for CodeExecutionLanguage
impl Clone for CodeExecutionLanguage
Source§fn clone(&self) -> CodeExecutionLanguage
fn clone(&self) -> CodeExecutionLanguage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodeExecutionLanguage
impl Debug for CodeExecutionLanguage
Source§impl Default for CodeExecutionLanguage
impl Default for CodeExecutionLanguage
Source§fn default() -> CodeExecutionLanguage
fn default() -> CodeExecutionLanguage
Source§impl<'de> Deserialize<'de> for CodeExecutionLanguage
impl<'de> Deserialize<'de> for CodeExecutionLanguage
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 CodeExecutionLanguage
impl Display for CodeExecutionLanguage
Source§impl PartialEq for CodeExecutionLanguage
impl PartialEq for CodeExecutionLanguage
Source§impl Serialize for CodeExecutionLanguage
impl Serialize for CodeExecutionLanguage
impl Eq for CodeExecutionLanguage
impl StructuralPartialEq for CodeExecutionLanguage
Auto Trait Implementations§
impl Freeze for CodeExecutionLanguage
impl RefUnwindSafe for CodeExecutionLanguage
impl Send for CodeExecutionLanguage
impl Sync for CodeExecutionLanguage
impl Unpin for CodeExecutionLanguage
impl UnwindSafe for CodeExecutionLanguage
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<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>
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);Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.