langfuse_client_base/models/
create_score_source.rs1#![allow(deprecated)]
2use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17pub enum CreateScoreSource {
18 #[serde(rename = "API")]
19 Api,
20 #[serde(rename = "ANNOTATION")]
21 Annotation,
22}
23
24impl std::fmt::Display for CreateScoreSource {
25 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
26 match self {
27 Self::Api => write!(f, "API"),
28 Self::Annotation => write!(f, "ANNOTATION"),
29 }
30 }
31}
32
33impl crate::models::validation::Validate for CreateScoreSource {
34 fn validate_into(
35 &self,
36 _path: &crate::models::validation::Path<'_>,
37 _errors: &mut Vec<crate::models::validation::ValidationError>,
38 ) {
39 }
40}
41
42impl ::std::str::FromStr for CreateScoreSource {
43 type Err = crate::models::ParseEnumError;
44
45 fn from_str(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
46 match value {
47 "API" => Ok(Self::Api),
48 "ANNOTATION" => Ok(Self::Annotation),
49 _ => Err(crate::models::ParseEnumError::new(
50 "CreateScoreSource",
51 value,
52 )),
53 }
54 }
55}
56
57impl ::std::convert::TryFrom<&str> for CreateScoreSource {
58 type Error = crate::models::ParseEnumError;
59
60 fn try_from(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
61 value.parse()
62 }
63}
64
65impl ::std::convert::TryFrom<&::std::string::String> for CreateScoreSource {
66 type Error = crate::models::ParseEnumError;
67
68 fn try_from(
69 value: &::std::string::String,
70 ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
71 value.parse()
72 }
73}
74
75impl ::std::convert::TryFrom<::std::string::String> for CreateScoreSource {
76 type Error = crate::models::ParseEnumError;
77
78 fn try_from(
79 value: ::std::string::String,
80 ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
81 value.parse()
82 }
83}