expression

Adjust channel brightness without integer wraparound

For a simple encoded-channel brightness adjustment, add an unsigned increment and clamp at 255. This is not a physically correct exposure adjustment in linear light. In an RGBA image, preserve alpha unless changing transparency is intended. Expected result (NOT RUN): [40, 230, 255] Common mistake: Using wrapping addition or assuming encoded RGB values are proportional to light intensity. Static Rust example; not a verified ByteMind executable assessment.

Formal Syntax & Structure

rust syntaxrust
channel.saturating_add(amount)

Working Example

Example Snippetrust
fn main() {    let pixels = [10u8, 200, 250];    let brighter = pixels.map(|c| c.saturating_add(30));    println!("{brighter:?}");}
Rust Reference