/// Produces the intersection of two descriptor requirements, so that the requirements of both
/// are satisfied. An error is returned if the requirements conflict.
Produces the intersection of two descriptor requirements, so that the requirements of both
are satisfied. An error is returned if the requirements conflict.
Produces the intersection of two descriptor requirements so that the requirements of both are satisfied . An error is returned if the requirements conflict .
pub fn intersection(&self, other: &Self) -> Result<Self, DescriptorRequirementsIncompatible> {
        let descriptor_types: Vec<_> = self
            .descriptor_types
            .iter()
            .copied()
            .filter(|ty| other.descriptor_types.contains(&ty))
            .collect();
        if descriptor_types.is_empty() {
            return Err(DescriptorRequirementsIncompatible::DescriptorType);
        }
        if let (Some(first), Some(second)) = (self.format, other.format) {
            if first != second {
                return Err(DescriptorRequirementsIncompatible::Format);
            }
        }
        if let (Some(first), Some(second)) = (self.image_view_type, other.image_view_type) {
            if first != second {
                return Err(DescriptorRequirementsIncompatible::ImageViewType);
            }
        }
        if self.multisampled != other.multisampled {
            return Err(DescriptorRequirementsIncompatible::Multisampled);
        }
        Ok(Self {
            descriptor_types,
            descriptor_count: self.descriptor_count.max(other.descriptor_count),
            format: self.format.or(other.format),
            image_view_type: self.image_view_type.or(other.image_view_type),
            multisampled: self.multisampled,
            mutable: self.mutable || other.mutable,
            stages: self.stages | other.stages,
        })
    }
pub fn intersection ( & self , other : & Self ) -> Result < Self , DescriptorRequirementsIncompatible > { let descriptor_types : Vec < _ > = self . descriptor_types . iter ( ) . copied ( ) . filter ( | ty | other . descriptor_types . contains ( & ty ) ) . collect ( ) ; if descriptor_types . is_empty ( ) { return Err ( DescriptorRequirementsIncompatible :: DescriptorType ) ; } if let ( Some ( first ) , Some ( second ) ) = ( self . format , other . format ) { if first != second { return Err ( DescriptorRequirementsIncompatible :: Format ) ; } } if let ( Some ( first ) , Some ( second ) ) = ( self . image_view_type , other . image_view_type ) { if first != second { return Err ( DescriptorRequirementsIncompatible :: ImageViewType ) ; } } if self . multisampled != other . multisampled { return Err ( DescriptorRequirementsIncompatible :: Multisampled ) ; } Ok ( Self { descriptor_types , descriptor_count : self . descriptor_count . max ( other . descriptor_count ) , format : self . format . or ( other . format ) , image_view_type : self . image_view_type . or ( other . image_view_type ) , multisampled : self . multisampled , mutable : self . mutable || other . mutable , stages : self . stages | other . stages , } ) }
Produces the intersection of two descriptor requirements, so that the requirements of both
are satisfied.
Produces the intersection of two descriptor requirements so that the requirements of both are satisfied .
&self
other
&Self