#[non_exhaustive]pub enum ChecksumMismatch {
Crc32c(String),
MD5(String),
Both(String),
}Expand description
The error type for checksum comparisons.
By default the client library computes a checksum of the uploaded data, and compares this checksum against the value returned by the service.
§Example
use std::error::Error as _;
let upload = client
.upload_object("projects/_/buckets/my-bucket", "my-object", "hello world")
.with_if_generation_not_match(0);
match upload.send().await {
Ok(object) => println!("Successfully uploaded the object"),
Err(error) if error.is_serialization() => {
println!("Some problem {error:?} sending the data to the service");
if let Some(m) = error.source().and_then(|e| e.downcast_ref::<ChecksumMismatch>()) {
println!("The checksums did not match: {m}");
}
},
Err(e) => return Err(e.into()), // not handled in this example
}§Troubleshooting
Data integrity problems are notoriously difficult to root cause. If you are using pre-existing, or pre-computed checksum values, you may want to verify the source data.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Trait Implementations§
Source§impl Debug for ChecksumMismatch
impl Debug for ChecksumMismatch
Source§impl Display for ChecksumMismatch
impl Display for ChecksumMismatch
Source§impl Error for ChecksumMismatch
impl Error for ChecksumMismatch
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ChecksumMismatch
impl RefUnwindSafe for ChecksumMismatch
impl Send for ChecksumMismatch
impl Sync for ChecksumMismatch
impl Unpin for ChecksumMismatch
impl UnwindSafe for ChecksumMismatch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.