Download codex-rs/app-server-protocol/src/protocol/serde_helpers.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/serde_helpers.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/app-server-protocol/src/protocol/serde_helpers.rs
-
curl -L -o serde_helpers.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/serde_helpers.rs
1.02 kB
| use std::path::PathBuf; | |
| use serde::Deserialize; | |
| use serde::Deserializer; | |
| use serde::Serialize; | |
| use serde::Serializer; | |
| pub(crate) fn nullable_string_schema( | |
| generator: &mut schemars::r#gen::SchemaGenerator, | |
| ) -> schemars::schema::Schema { | |
| generator.subschema_for::<Option<String>>() | |
| } | |
| pub fn deserialize_empty_path_as_none<'de, D>(deserializer: D) -> Result<Option<PathBuf>, D::Error> | |
| where | |
| D: Deserializer<'de>, | |
| { | |
| let path = Option::<PathBuf>::deserialize(deserializer)?; | |
| Ok(path.filter(|path| !path.as_os_str().is_empty())) | |
| } | |
| pub fn deserialize_double_option<'de, T, D>(deserializer: D) -> Result<Option<Option<T>>, D::Error> | |
| where | |
| T: Deserialize<'de>, | |
| D: Deserializer<'de>, | |
| { | |
| serde_with::rust::double_option::deserialize(deserializer) | |
| } | |
| pub fn serialize_double_option<T, S>( | |
| value: &Option<Option<T>>, | |
| serializer: S, | |
| ) -> Result<S::Ok, S::Error> | |
| where | |
| T: Serialize, | |
| S: Serializer, | |
| { | |
| serde_with::rust::double_option::serialize(value, serializer) | |
| } | |