tuigui 0.23.0

An easy-to-use, highly extensible, and speedy TUI library.
Documentation
use crate::preludes::shader_creation::*;

/// Useful for when you need to add a bunch of shaders with different types
/// to a shader sequence or something else that needs a list of shaders with
/// a single type
pub struct ShaderDyn {
    pub shader: Box<dyn Shader>,
}

impl ShaderDyn {
    pub fn new(shader: Box<dyn Shader>) -> Self {
        Self {
            shader,
        }
    }
}

impl Shader for ShaderDyn {
    fn apply(&mut self, canvas: &Canvas, position: Position, content: Option<&Content>) -> Option<Content> {
        return self.shader.apply(canvas, position, content);
    }

    fn config(&self) -> ShaderConfig {
        return self.shader.config();
    }
}