-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make mime partial eq to use in pattern match #134
Comments
error: to use a constant of type `Mime` in a pattern, `Mime` must be annotated with `#[derive(PartialEq, Eq)]`
--> libs\src\models.rs:345:13
|
345 | mime::APPLICATION_PDF => DownloadedFile::Pdf(file.content().to_owned()), |
This issue still stands and prevents pattern matching on constant types: if let Some(mime::IMAGE_JPEG | mime::IMAGE_PNG) = beresp.get_content_type() {
do_stuff();
} The alternative to this code block following the pattern in the README would be: if let Some(mime) = beresp.get_content_type() {
match (mime.type_(), mime.subtype()) {
(mime::IMAGE, mime::JPEG | mime::PNG) => do_stuff(),
_ => {}
}
} |
This would be resolved by #137. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: