cleanup: more clearly document find_allowed
This commit is contained in:
parent
b03e62069f
commit
50ccb2b60a
1 changed files with 6 additions and 3 deletions
|
|
@ -86,12 +86,15 @@ pub trait AsMimeTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MimeType {
|
impl MimeType {
|
||||||
/// Find first allowed mime type among the `offered_mime_types`.
|
/// Find first offered mime type among the `allowed_mime_types`.
|
||||||
///
|
///
|
||||||
/// `find_allowed()` searches for mime type clipboard supports, if we have a
|
/// `find_allowed()` searches for mime type clipboard supports, if we have a
|
||||||
/// match, returns `Some(MimeType)`, otherwise `None`.
|
/// match, returns `Some(MimeType)`, otherwise `None`.
|
||||||
pub fn find_allowed(offered_mime_types: &[String], allowed: &[Self]) -> Option<Self> {
|
pub fn find_allowed(
|
||||||
allowed
|
offered_mime_types: &[String],
|
||||||
|
allowed_mime_types: &[Self],
|
||||||
|
) -> Option<Self> {
|
||||||
|
allowed_mime_types
|
||||||
.iter()
|
.iter()
|
||||||
.find(|allowed| {
|
.find(|allowed| {
|
||||||
offered_mime_types.iter().any(|offered| offered.as_str() == allowed.as_ref())
|
offered_mime_types.iter().any(|offered| offered.as_str() == allowed.as_ref())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue