diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /vendor/icu_provider/src/serde/mod.rs | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.tar.xz rustc-5cd5bd4daf55da04d2c8e7c06c3067a027cfbfc2.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | vendor/icu_provider/src/serde/mod.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/vendor/icu_provider/src/serde/mod.rs b/vendor/icu_provider/src/serde/mod.rs index d32148f02..2e96b3cb3 100644 --- a/vendor/icu_provider/src/serde/mod.rs +++ b/vendor/icu_provider/src/serde/mod.rs @@ -94,7 +94,7 @@ impl DataPayload<BufferMarker> { /// /// # Examples /// - /// Requires the `deserialize_json` feature: + /// Requires the `deserialize_json` Cargo feature: /// /// ``` /// use icu_provider::buf::BufferFormat; @@ -136,16 +136,16 @@ where { fn load_data(&self, key: DataKey, req: DataRequest) -> Result<DataResponse<M>, DataError> { let buffer_response = BufferProvider::load_buffer(self.0, key, req)?; - let buffer_format = buffer_response - .metadata - .buffer_format - .ok_or_else(|| DataError::custom("BufferProvider didn't set BufferFormat"))?; + let buffer_format = buffer_response.metadata.buffer_format.ok_or_else(|| { + DataError::custom("BufferProvider didn't set BufferFormat").with_req(key, req) + })?; Ok(DataResponse { metadata: buffer_response.metadata, payload: buffer_response .payload .map(|p| p.into_deserialized(buffer_format)) - .transpose()?, + .transpose() + .map_err(|e| e.with_req(key, req))?, }) } } @@ -165,21 +165,21 @@ where } } -#[cfg(feature = "serde_json")] +#[cfg(feature = "deserialize_json")] impl From<serde_json::error::Error> for crate::DataError { fn from(e: serde_json::error::Error) -> Self { crate::DataError::custom("JSON deserialize").with_display_context(&e) } } -#[cfg(feature = "bincode")] +#[cfg(feature = "deserialize_bincode_1")] impl From<bincode::Error> for crate::DataError { fn from(e: bincode::Error) -> Self { crate::DataError::custom("Bincode deserialize").with_display_context(&e) } } -#[cfg(feature = "postcard")] +#[cfg(feature = "deserialize_postcard_1")] impl From<postcard::Error> for crate::DataError { fn from(e: postcard::Error) -> Self { crate::DataError::custom("Postcard deserialize").with_display_context(&e) |