pub struct MatrixConfig {
pub charset: CharSet,
pub theme: Theme,
pub fps: u16,
pub speed: f32,
pub density: f32,
pub min_trail: u16,
pub max_trail: u16,
pub mutation_rate: f32,
pub bold_head: bool,
pub head_white: bool,
pub glitch: f32,
pub background: Option<Color>,
}Expand description
Read-only configuration for MatrixRain.
Construct via MatrixConfig::builder (validated) or
MatrixConfig::default (always valid, classic Matrix look). All fields
are public so the struct also supports destructuring for inspection.
§Example
use matrix_rain::MatrixConfig;
let cfg = MatrixConfig::builder().fps(60).density(0.8).build().unwrap();
assert_eq!(cfg.fps, 60);
assert_eq!(cfg.density, 0.8);Fields§
§charset: CharSetGlyph source. Default: CharSet::Matrix (katakana + digits).
theme: ThemeColor theme. Default: Theme::ClassicGreen.
fps: u16Frames per second (must be >= 1). Acts as the wall-clock tick budget
when wall-clock driving and as the divisor for speed. Default: 30.
speed: f32Global speed multiplier (must be finite and > 0.0). Scales the
effective tick rate consumed from wall-clock elapsed time. Default: 1.0.
density: f32Fraction of columns to keep active. 0.0 = no spawns ever; 1.0 =
every idle column attempts respawn each tick after cooldown. Must be
finite and in [0.0, 1.0]. Default: 0.6.
min_trail: u16Minimum trail length. Must be >= 1 and <= max_trail. Default: 6.
max_trail: u16Maximum trail length. Must be <= MAX_TRAIL_LIMIT. Default: 20.
mutation_rate: f32Per-cell glyph-reroll probability per tick. Must be finite and in
[0.0, 1.0]. 0.0 freezes glyphs after spawn; 1.0 rerolls every
cell every frame. Default: 0.05.
bold_head: boolApply Modifier::BOLD to the head cell when true. Default: true.
head_white: boolUse ColorRamp.head (typically white) for the head cell when true,
ColorRamp.bright when false. Default: true.
glitch: f32Per-cell color-flicker probability per tick. On hit, the cell renders
with ColorRamp.head instead of its gradient color (a “sparkle”).
Head cell (i=0) is unaffected. Must be finite and in [0.0, 1.0].
Default: 0.0 (off).
background: Option<Color>Optional background color. None (default) renders transparently,
skipping cells in the fade zone so the underlying buffer shows
through. Some(c) skips any cell whose computed color equals c —
useful when compositing over a known background.
Implementations§
Source§impl MatrixConfig
impl MatrixConfig
Sourcepub fn builder() -> MatrixConfigBuilder
pub fn builder() -> MatrixConfigBuilder
Returns a new MatrixConfigBuilder seeded with defaults.
Call setters to override fields, then build
to validate and produce a MatrixConfig.
Trait Implementations§
Source§impl Clone for MatrixConfig
impl Clone for MatrixConfig
Source§fn clone(&self) -> MatrixConfig
fn clone(&self) -> MatrixConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MatrixConfig
impl Debug for MatrixConfig
Auto Trait Implementations§
impl Freeze for MatrixConfig
impl RefUnwindSafe for MatrixConfig
impl Send for MatrixConfig
impl Sync for MatrixConfig
impl Unpin for MatrixConfig
impl UnsafeUnpin for MatrixConfig
impl UnwindSafe for MatrixConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more