Skip to main content

Transform

Trait Transform 

Source
pub trait Transform<'a, 'ctx, M: NodeMetadata, N: NodeWithMetadata<M>, F: TransformerFeatures<M, N>> {
    // Required methods
    fn skips_subtree(metadata: &M) -> bool;
    fn new(transformer: &'ctx Transformer<'a, M, N, F>) -> Self;
}

Required Methods§

Source

fn skips_subtree(metadata: &M) -> bool

Returns true when a subtree described by metadata cannot contain anything this transform rewrites.

Transformer asks this of the root node before running the transform at all, and the transform asks it of every queryable node it enters, pruning the subtree when it holds. Metadata aggregates upwards, so a kind absent from metadata is absent from the whole subtree: answering true for a subtree that does contain such a node silently skips work.

Source

fn new(transformer: &'ctx Transformer<'a, M, N, F>) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for ReduceCharsetRule<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for ReduceColors<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for ReduceLengths<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for ReduceShorthandValues<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for ReduceTimeUnits<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for ReduceUrls<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for RemoveInertNodes<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,

Source§

impl<'a, 'ctx, N> Transform<'a, 'ctx, CssMetadata, N, CssMinifierFeature> for RemoveOverriddenDeclarations<'a, 'ctx, N>
where N: Visitable + NodeWithMetadata<CssMetadata>,