Skip to main content

EffectExt

Trait EffectExt 

Source
pub trait EffectExt: Effect {
    // Provided method
    fn paint<B: Blitter>(&mut self, blitter: &mut B, dst: &mut Surface<'_>) { ... }
}
Expand description

CPU-convenience extension trait: bridge a Blitter into a throwaway BlitterSink and call Effect::draw in one step.

The generic paint<B: Blitter> method is kept here rather than on Effect itself so that Effect stays object-safe. Any type that implements Effect automatically gets this method — hosts keep writing effect.paint(&mut blitter, &mut dst) exactly like before.

Provided Methods§

Source

fn paint<B: Blitter>(&mut self, blitter: &mut B, dst: &mut Surface<'_>)

Paint the current frame into dst using blitter.

Shorthand for constructing a BlitterSink over (blitter, dst) and calling Effect::draw.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T: Effect + ?Sized> EffectExt for T