css-autoprefix 0.0.5

Provides a library similar to [autoprefixer](https://github.com/postcss/autoprefixer) to prefix your CSS depending on the versions of web browsers, but in Rust. Currently needs nightly rust as a dependency (phf) needs nightly. Makes use of caniuse.com's database via caniuse-serde (ie offline).
// This file is part of css-autoprefix. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css-autoprefix/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2017 The developers of css-autoprefix. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css-autoprefix/master/COPYRIGHT.


/// Holds a set of style rules autoprefixers and applies their rules in turn.
/// Does not handle the intersection of property declaration that needs both a name and value prefixing.
#[derive(Default, Debug, Clone)]
pub struct CompositePropertyDeclarationAutoprefixer
{
	propertyNameAutoprefixers: Vec<PropertyNamePropertyDeclarationAutoprefixer>,
	simplePropertyValueAutoprefixers: Vec<SimplePropertyValuePropertyDeclarationAutoprefixer>,
}

impl PropertyDeclarationAutoprefixer for CompositePropertyDeclarationAutoprefixer
{
	#[inline(always)]
	fn autoprefix<H: HasPropertyDeclarations<I>, I: HasImportance>(&self, property_declarations: &mut H, parent_vendor_prefix: Option<&VendorPrefix>)
	{
		for autoprefixer in self.propertyNameAutoprefixers.iter()
		{
			autoprefixer.autoprefix(property_declarations, parent_vendor_prefix);
		}
		for autoprefixer in self.simplePropertyValueAutoprefixers.iter()
		{
			autoprefixer.autoprefix(property_declarations, parent_vendor_prefix);
		}
	}
}

impl CompositePropertyDeclarationAutoprefixer
{
	#[inline(always)]
	pub(crate) fn new(can_i_use: &CanIUse, agents: &AgentNameAndVersionSet) -> Self
	{
		Self
		{
			propertyNameAutoprefixers: PropertyNamePropertyDeclarationAutoprefixerCreator::new(can_i_use, agents),
			simplePropertyValueAutoprefixers: SimplePropertyValuePropertyDeclarationAutoprefixerCreator::new(can_i_use, agents),
		}
	}
}