Download next.js/turbopack/crates/turbopack-trace-server/src/u64_string.rs from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 488 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbopack-trace-server/src/u64_string.rs
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/turbopack/crates/turbopack-trace-server/src/u64_string.rs
-
curl -L -o u64_string.rs https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/turbopack/crates/turbopack-trace-server/src/u64_string.rs
488 Bytes
| use std::{fmt::Display, str::FromStr}; | |
| use serde::{Deserialize, Deserializer, Serializer, de}; | |
| pub fn serialize<T, S>(value: &T, serializer: S) -> Result<S::Ok, S::Error> | |
| where | |
| T: Display, | |
| S: Serializer, | |
| { | |
| serializer.collect_str(value) | |
| } | |
| pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error> | |
| where | |
| T: FromStr, | |
| T::Err: Display, | |
| D: Deserializer<'de>, | |
| { | |
| String::deserialize(deserializer)? | |
| .parse() | |
| .map_err(de::Error::custom) | |
| } | |