| { | ||
| "git": { | ||
| "sha1": "ac390154c7650010a819ee58bd48552e64f2c3f0" | ||
| "sha1": "8b080b3753b91c58113c47c99108185d0614499c" | ||
| }, | ||
| "path_in_vcs": "utils/tinystr" | ||
| } |
+4
-4
@@ -14,5 +14,5 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| edition = "2021" | ||
| rust-version = "1.66" | ||
| rust-version = "1.67" | ||
| name = "tinystr" | ||
| version = "0.7.4" | ||
| version = "0.7.5" | ||
| authors = ["The ICU4X Project Developers"] | ||
@@ -81,3 +81,3 @@ include = [ | ||
| [dependencies.databake] | ||
| version = "0.1.6" | ||
| version = "0.1.7" | ||
| optional = true | ||
@@ -97,3 +97,3 @@ default-features = false | ||
| [dependencies.zerovec] | ||
| version = "0.10.0" | ||
| version = "0.10.1" | ||
| optional = true | ||
@@ -100,0 +100,0 @@ default-features = false |
+18
-1
@@ -7,2 +7,3 @@ // This file is part of ICU4X. For terms of use, please see the file | ||
| use crate::TinyStrError; | ||
| use core::fmt; | ||
@@ -16,5 +17,15 @@ /// A fixed-length bytes array that is expected to be an ASCII string but does not enforce that invariant. | ||
| /// human-readable formats like JSON. | ||
| #[derive(Debug, PartialEq, PartialOrd, Eq, Ord, Clone, Copy)] | ||
| #[derive(PartialEq, PartialOrd, Eq, Ord, Clone, Copy)] | ||
| pub struct UnvalidatedTinyAsciiStr<const N: usize>(pub(crate) [u8; N]); | ||
| impl<const N: usize> fmt::Debug for UnvalidatedTinyAsciiStr<N> { | ||
| fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
| // Debug as a string if possible | ||
| match self.try_into_tinystr() { | ||
| Ok(s) => fmt::Debug::fmt(&s, f), | ||
| Err(_) => fmt::Debug::fmt(&self.0, f), | ||
| } | ||
| } | ||
| } | ||
| impl<const N: usize> UnvalidatedTinyAsciiStr<N> { | ||
@@ -41,2 +52,8 @@ #[inline] | ||
| impl<const N: usize> From<TinyAsciiStr<N>> for UnvalidatedTinyAsciiStr<N> { | ||
| fn from(other: TinyAsciiStr<N>) -> Self { | ||
| other.to_unvalidated() | ||
| } | ||
| } | ||
| #[cfg(feature = "serde")] | ||
@@ -43,0 +60,0 @@ impl<const N: usize> serde::Serialize for UnvalidatedTinyAsciiStr<N> { |
Sorry, the diff of this file is not supported yet