### Install and Run cloc for Codebase Analysis Source: https://github.com/leerob/pixo/blob/main/docs/codebase-size-comparison.md This snippet provides commands for installing and using `cloc` (Count Lines of Code) to analyze codebases. It covers installation, basic line counting, detailed file breakdowns, and excluding specific directories from the analysis. ```bash # Install cloc sudo apt-get install cloc # Count lines in a directory cloc src/ tests/ benches/ # Detailed breakdown by file cloc --by-file src/ # Exclude directories cloc . --exclude-dir=target,.git,node_modules ``` -------------------------------- ### Pixo CLI Image Conversion and Optimization Examples (Bash) Source: https://context7.com/leerob/pixo/llms.txt Demonstrates various command-line interface commands for the Pixo tool, showcasing image format conversion, quality settings, subsampling, presets, and pipeline usage. These examples cover common image manipulation tasks via the CLI. ```bash # Convert PNG to JPEG with default quality (85) pixo input.png -o output.jpg # Maximum PNG compression with all optimizations pixo photo.jpg -o compressed.png --preset max # JPEG with custom quality and 4:2:0 chroma subsampling pixo image.png -o image.jpg -q 90 --subsampling s420 # PNG with specific compression level and filter strategy pixo input.jpg -o output.png -c 9 --filter paeth # Convert to grayscale with verbose output pixo color.png -o gray.jpg --grayscale -v # Optimized JPEG with Huffman optimization pixo photo.png -o photo.jpg --jpeg-optimize-huffman # Read from stdin, write to stdout (pipeline) cat image.png | pixo - -o - -f jpeg > output.jpg # Dry run to preview compression ratio pixo large.png -o compressed.png -n --json ``` -------------------------------- ### Huffman Decoding Example Source: https://github.com/leerob/pixo/blob/main/docs/decoding.md Illustrates the process of reconstructing Huffman codes from received code lengths and how to decode an input bitstream by matching these codes. This is a core part of many compression algorithms. ```text Code lengths received: A=2, B=1, C=3, D=3 Rebuild codes (shorter codes get smaller values): B: 0 (length 1) A: 10 (length 2) C: 110 (length 3) D: 111 (length 3) Input bits: 1 1 0 1 0 0 ... ───── C A B Decoded: C, A, B, ... ``` -------------------------------- ### Install External Benchmarking Tools (macOS) Source: https://github.com/leerob/pixo/blob/main/benches/README.md Installs external tools commonly used for image compression benchmarking on macOS using Homebrew. This includes oxipng, mozjpeg, and pngquant, which are referenced in the comprehensive comparison benchmarks. ```bash # macOS (Homebrew) brew install oxipng mozjpeg pngquant # Verify installation oxipng --version cjpeg -version pngquant --version ``` -------------------------------- ### Install Pixo CLI using Cargo Source: https://github.com/leerob/pixo/blob/main/docs/cli.md Instructions for installing the pixo CLI tool from source or building it locally using Cargo, the Rust package manager. This ensures you have the latest version or a custom build. ```bash cargo install --path . --features cli ``` ```bash cargo build --release --features cli ``` -------------------------------- ### Basic Pixo CLI Usage Examples Source: https://github.com/leerob/pixo/blob/main/docs/cli.md Demonstrates fundamental ways to use the pixo CLI for image compression. Covers specifying input/output files, different formats (JPEG, PNG), and adjusting compression parameters. ```bash # Basic usage - compress to JPEG (default) pixo input.png -o output.jpg ``` ```bash # Compress to PNG with maximum compression pixo input.jpg -o output.png -c 9 ``` ```bash # JPEG with custom quality (1-100) pixo photo.png -o photo.jpg -q 90 ``` ```bash # JPEG with 4:2:0 chroma subsampling (smaller files) pixo photo.png -o photo.jpg --subsampling s420 ``` ```bash # PNG with specific filter strategy pixo input.jpg -o output.png --filter paeth ``` ```bash # Adaptive fast (reduced trials) filter strategy pixo input.jpg -o output.png --filter adaptive-fast ``` ```bash # Convert to grayscale pixo color.png -o gray.jpg --grayscale ``` ```bash # Verbose output with timing and size info pixo input.png -o output.jpg -v ``` ```bash # Preview operation without writing (dry run) pixo input.png -o output.jpg -n ``` ```bash # Quiet mode (suppress output) pixo input.png -o output.jpg --quiet ``` ```bash # JSON output for scripting pixo input.png -o output.jpg --json ``` -------------------------------- ### Simple Quantization Example Source: https://github.com/leerob/pixo/blob/main/docs/quantization.md A step-by-step illustration of the quantization process with a single DCT coefficient. It shows the calculation of the quantized result and the error introduced during reconstruction, highlighting the lossy nature of the operation. ```text DCT coefficient: 47 Quantization value: 10 Quantized result: round(47/10) = round(4.7) = 5 During decoding: Reconstructed: 5 × 10 = 50 Error: |47 - 50| = 3 ``` -------------------------------- ### Fast PNG Preset Configuration (Rust) Source: https://github.com/leerob/pixo/blob/main/docs/png-encoding.md Example of using the `fast()` preset for PNG encoding. This preset is optimized for speed and is suitable for development or real-time processing, offering a compression level of 2 and the 'AdaptiveFast' filter strategy. ```rust PngOptions::fast() ``` -------------------------------- ### Integer DCT Calculation Example Source: https://github.com/leerob/pixo/blob/main/docs/compression-evolution.md Illustrates the conversion of floating-point DCT constants to fixed-point integers for reproducible and potentially faster calculations. This method scales constants and uses bit shifts to replace division. ```text Floating-point: cos(π/8) = 0.9238795... Fixed-point: (0.9238795 × 8192) ≈ 7568 Multiplication becomes: result = (a × 7568) >> 13 // Shift replaces division ``` -------------------------------- ### Defining Structs and Methods in Rust Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Shows how to define data structures using Rust's `struct` keyword and associate behavior with them using `impl` blocks. This example defines a `Lz77Compressor` struct with fields for compression state. ```rust // From src/compress/lz77.rs pub struct Lz77Compressor { /// Hash table: maps hash -> most recent position head: Vec, /// Chain links: prev[pos % window] -> previous position with same hash prev: Vec, /// Compression level (affects search depth) max_chain_length: usize, /// Lazy matching: check if next position has better match lazy_matching: bool, } ``` -------------------------------- ### Pixo CLI Stdin/Stdout and Piping Examples Source: https://github.com/leerob/pixo/blob/main/docs/cli.md Illustrates how to use the pixo CLI with standard input (stdin) and standard output (stdout), enabling piping of image data between commands or processes. This is useful for complex workflows and integration with other tools. ```bash # Read from stdin, write to file cat photo.png | pixo - -o output.jpg ``` ```bash # Read from file, write to stdout pixo input.png -o - -f jpeg > output.jpg ``` ```bash # Pipe through compression curl https://example.com/image.png | pixo - -o - -f jpeg | upload-service ``` ```bash # Read from stdin (output path required) cat image.png | pixo - -o output.jpg ``` ```bash # Write to stdout pixo input.png -o - -f jpeg > output.jpg ``` ```bash # Both stdin and stdout cat image.png | pixo - -o - -f jpeg > output.jpg ``` -------------------------------- ### Balanced PNG Preset Configuration (Rust) Source: https://github.com/leerob/pixo/blob/main/docs/png-encoding.md Example of using the `balanced()` preset for PNG encoding. This preset is recommended for general use and web assets, providing a good balance between compression and speed. It uses a compression level of 6, the 'Adaptive' filter strategy, and applies various optimizations. ```rust PngOptions::balanced() ``` -------------------------------- ### Pixo CLI JSON Output Example Source: https://github.com/leerob/pixo/blob/main/docs/cli.md Shows how to obtain machine-readable output from the pixo CLI using the `--json` flag. This output is ideal for integrating pixo into scripts or other automated processes, providing structured data about the compression operation. ```bash $ pixo input.png -o output.jpg --json {"input":"input.png","output":"output.jpg","input_size":102400,"output_size":51200,"ratio":50.0} ``` ```bash $ pixo input.png -o output.jpg --json -n {"dry_run":true,"input":"input.png","output":"output.jpg","input_size":102400,"output_size":51200,"ratio":50.0} ``` -------------------------------- ### Build WASM Module with Pixo Source: https://github.com/leerob/pixo/blob/main/docs/wasm.md Commands to set up the Rust environment for WASM compilation, install necessary tools like wasm-bindgen-cli, build the WASM module, generate JavaScript bindings, and optimize the WASM binary using binaryen. ```bash # Install the WASM target rustup target add wasm32-unknown-unknown # Install wasm-bindgen CLI cargo install wasm-bindgen-cli # Build the WASM module cargo build --target wasm32-unknown-unknown --release --no-default-features --features wasm,simd # Generate JS bindings (output to web/src/lib/pixo-wasm/) wasm-bindgen --target web \ --out-dir web/src/lib/pixo-wasm/ \ --out-name pixo \ target/wasm32-unknown-unknown/release/pixo.wasm # (Optional but recommended) Optimize with binaryen for minimal size wasm-opt -Oz --strip-debug --strip-dwarf --strip-producers --strip-target-features \ --enable-bulk-memory --enable-sign-ext --enable-nontrapping-float-to-int \ -o web/src/lib/pixo-wasm/pixo_bg.wasm \ web/src/lib/pixo-wasm/pixo_bg.wasm ``` -------------------------------- ### Maximum PNG Preset Configuration (Rust) Source: https://github.com/leerob/pixo/blob/main/docs/png-encoding.md Example of using the `max()` preset for PNG encoding. This preset is designed for final distribution where every byte counts, offering the highest compression. It utilizes a compression level of 9, 'MinSum' filter strategy with iterative refinement, and Zopfli-style DEFLATE optimizations. ```rust PngOptions::max() ``` -------------------------------- ### Rust Runtime CPU Feature Detection (x86) Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Provides an example of detecting CPU features at runtime using `is_x86_feature_detected!`. This macro is used for conditionally enabling optimized code paths, like AVX2, and its result is cached after the first check. ```rust if is_x86_feature_detected!("avx2") { // Use AVX2 implementation } ``` -------------------------------- ### Pattern Matching with Rust Enums Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Demonstrates how to use the `match` statement to perform exhaustive pattern matching on Rust enums. The compiler enforces that all variants are handled, preventing runtime errors. This example shows matching on a `Token` enum with `Literal` and `Match` variants. ```rust // From src/compress/lz77.rs (test) for token in &tokens { match token { Token::Literal(b) => reconstructed.push(*b), Token::Match { length, distance } => { let start = reconstructed.len() - *distance as usize; for i in 0..*length as usize { reconstructed.push(reconstructed[start + i]); } } } } ``` -------------------------------- ### Rust: Chaining Iterator Methods for Transformation Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Shows how to chain iterator methods in Rust for concise data transformation. This example maps each byte in an `indexed` collection to a new value using a `byte_map` and collects the results into a new `Vec`. This functional style emphasizes readability and avoids manual loop management. ```rust // From src/png/mod.rs let new_indexed: Vec = indexed .iter() .map(|&b| byte_map[b as usize]) .collect(); ``` -------------------------------- ### Rust Platform-Specific Code Compilation Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Shows how to use `#[cfg]` with `target_arch` to compile platform-specific code, such as different SIMD implementations for x86_64 and aarch64 architectures. Includes a fallback for unsupported architectures, ensuring that only relevant code is included in the final binary. ```rust // From src/simd/mod.rs #[inline] pub fn adler32(data: &[u8]) -> u32 { #[cfg(target_arch = "x86_64")] { if is_x86_feature_detected!("avx2") { return unsafe { x86_64::adler32_avx2(data) }; } if is_x86_feature_detected!("ssse3") { return unsafe { x86_64::adler32_ssse3(data) }; } fallback::adler32(data) } #[cfg(target_arch = "aarch64")] { // NEON is always available on aarch64 unsafe { aarch64::adler32_neon(data) } } #[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))] fallback::adler32(data) } ``` -------------------------------- ### Rust Preset Pattern with Overrides Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Demonstrates a common pattern for providing default configurations (presets) that can be easily overridden. The `PngOptions` struct has methods for different presets (`fast`, `balanced`, `max`), and a `from_preset` function allows selecting one via a simple identifier. ```rust impl PngOptions { pub fn fast() -> Self { /* low compression, high speed */ } pub fn balanced() -> Self { /* good tradeoff */ } pub fn max() -> Self { /* maximum compression */ } pub fn from_preset(preset: u8) -> Self { match preset { 0 => Self::fast(), 2 => Self::max(), _ => Self::balanced(), } } } ``` -------------------------------- ### Install Pixo Crate Source: https://github.com/leerob/pixo/blob/main/docs/crate.md Add the pixo crate as a dependency to your Rust project by including it in your Cargo.toml file. ```toml [dependencies] pixo = "0.1" ``` -------------------------------- ### JPEG Marker Segment Identification Source: https://github.com/leerob/pixo/blob/main/docs/decoding.md Lists common JPEG marker segments and their meanings. These markers, starting with 0xFF, are crucial for the decoder to understand the structure of the JPEG file, including tables and scan data. ```text FFD8 SOI (Start of Image) FFE0 xxxx APP0 (JFIF metadata) FFDB xxxx DQT (Quantization tables) FFC0 xxxx SOF0 (Frame header: dimensions, components) FFC4 xxxx DHT (Huffman tables) FFDA xxxx SOS (Start of Scan, followed by entropy-coded data) FFD9 EOI (End of Image) ``` -------------------------------- ### Progressive JPEG Scan Structure Source: https://github.com/leerob/pixo/blob/main/docs/compression-evolution.md Visualizes the multi-scan approach in progressive JPEG encoding. It breaks down the encoding process into stages, starting with overall brightness (DC coefficients) and progressing to finer details (AC coefficients). ```text Progressive Scan Structure ══════════════════════════ Scan 1: DC coefficients only (overall brightness) ┌─────────────────────────────────────┐ │ ██ │ Just the average │ │ brightness of each │ │ 8×8 block └─────────────────────────────────────┘ Scan 2: Low-frequency AC (basic shapes) ┌─────────────────────────────────────┐ │ ██ ░░ │ Basic gradients │ ░░ │ and large shapes │ │ └─────────────────────────────────────┘ Scan 3-N: Higher frequencies (details, texture) ┌─────────────────────────────────────┐ │ ██ ░░ ░░ ▒▒ ▒▒ ▒▒ ░░ ░░ │ Fine details │ ░░ ▒▒ ▒▒ ▒▒ ░░ ░░ ░░ ░░ │ and textures │ ░░ ▒▒ ░░ ░░ ░░ ░░ ░░ │ └─────────────────────────────────────┘ ``` -------------------------------- ### Rust Ownership Transfer Example Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Illustrates Rust's compile-time error for using a variable after its ownership has been moved. This prevents use-after-move errors by ensuring values are only accessed by their current owner. ```rust // This won't compile! let tokens = compressor.compress(data); let oops = tokens; // Ownership moves to 'oops' println!("{:?}", tokens); // Error: tokens was moved ``` -------------------------------- ### Grayscale JPEG Encoding (Rust) Source: https://context7.com/leerob/pixo/llms.txt Encodes single-channel grayscale images into JPEG format using `pixo`. This example shows how to set the `ColorType` to `Gray` and apply optimizations for grayscale processing. ```rust use pixo::jpeg::{encode, JpegOptions}; use pixo::ColorType; fn main() -> pixo::Result<()> { let mut pixels = Vec::with_capacity(320 * 240); for y in 0..240 { for x in 0..320 { pixels.push(((x + y) / 2) as u8); } } let options = JpegOptions::builder(320, 240) .color_type(ColorType::Gray) .quality(90) .optimize_huffman(true) .build(); let jpeg_bytes = encode(&pixels, &options)?; std::fs::write("grayscale.jpg", jpeg_bytes)?; Ok(()) } ``` -------------------------------- ### JPEG Dequantization Example Source: https://github.com/leerob/pixo/blob/main/docs/decoding.md Illustrates the dequantization step in JPEG decoding. The decoder multiplies the quantized DCT coefficients by the corresponding values from the quantization table to recover approximate coefficients. It notes that information lost during quantization cannot be recovered. ```text Quantized: [60, -2, 1, 0, 0, ...] Quantization table: [16, 11, 10, ...] Dequantized: 60 × 16 = 960 -2 × 11 = -22 1 × 10 = 10 0 × 16 = 0 ... Note: Information lost during quantization cannot be recovered. The decoder gets an approximation, not the original DCT coefficients. ``` -------------------------------- ### Configure PNG Encoding Options (Rust) Source: https://github.com/leerob/pixo/blob/main/docs/png-encoding.md Demonstrates how to configure PNG encoding options in Pixo, specifically setting the filter strategy to 'MinSum' and compression level to 6. Other default options are retained using the `..Default::default()` syntax. ```rust use pixo::png::{PngOptions, FilterStrategy}; let options = PngOptions { filter_strategy: FilterStrategy::MinSum, compression_level: 6, ..Default::default() }; ``` -------------------------------- ### Troubleshooting Homebrew + rustup Conflict for WASM Build Source: https://github.com/leerob/pixo/blob/main/docs/wasm.md Diagnose and resolve potential conflicts between Homebrew's Rust installation and rustup, ensuring that cargo uses the correct Rust compiler for WASM builds. ```bash # Check which rustc is being used which rustc # Should be ~/.cargo/bin/rustc for rustup # If Homebrew's rustc is used, explicitly set the correct one: RUSTC=~/.cargo/bin/rustc cargo build --target wasm32-unknown-unknown --release --features wasm ``` -------------------------------- ### Rust: Module Declaration and Re-exporting Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Demonstrates Rust's module system for organizing code. It shows how to declare public modules (`pub mod`) and conditionally compiled modules (`#[cfg(...)] pub mod`). It also illustrates re-exporting items from submodules using `pub use` for convenience, making them accessible at the parent module's level. ```rust // From src/lib.rs pub mod bits; pub mod color; pub mod compress; pub mod error; pub mod jpeg; pub mod png; #[cfg(feature = "simd")] pub mod simd; // Only compiled when "simd" feature is enabled pub use color::ColorType; // Re-export for convenience pub use error::{Error, Result}; ``` -------------------------------- ### JPEG Decoding Pipeline Overview Source: https://github.com/leerob/pixo/blob/main/docs/decoding.md Visualizes the JPEG decoding process, starting from the JPEG file and progressing through Huffman decoding, dequantization, and inverse DCT to produce raw RGB pixels. It also outlines the marker parsing steps. ```text ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ JPEG File │───▶│ Huffman │───▶│ Dequantize │───▶│ Inverse DCT │ │ (markers) │ │ Decode │ │ (multiply) │ │ (IDCT) │ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ │ │ ▼ ├── Parse SOI, APP0 ┌─────────────┐ ┌─────────────┐ ├── Read DQT tables │ Raw Pixels │◀───│ YCbCr → │ ├── Read DHT tables │ (RGB) │ │ RGB │ └── Parse SOS scan └─────────────┘ └─────────────┘ ``` -------------------------------- ### Rust: Implementing LZ77 Compressor Methods Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Demonstrates adding methods to the Lz77Compressor struct in Rust. Includes a constructor `new` and a `compress` method. It highlights Rust conventions like `Self` as a type alias and `&mut self` for mutable borrows. The `new` method initializes compressor state based on a compression level. ```rust impl Lz77Compressor { /// Create a new LZ77 compressor. pub fn new(level: u8) -> Self { let level = level.clamp(1, 9); let (max_chain_length, lazy_matching) = match level { 1 => (4, false), 2 => (8, false), // ... 9 => (4096, false), _ => (128, false), }; Self { head: vec![-1; HASH_SIZE], prev: vec![-1; MAX_DISTANCE], max_chain_length, lazy_matching, } } /// Compress data and return LZ77 tokens. pub fn compress(&mut self, data: &[u8]) -> Vec { let mut tokens = Vec::with_capacity(data.len()); self.compress_into(data, &mut tokens); tokens } } ``` -------------------------------- ### Rust: Builder Pattern with PngOptions Struct Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Illustrates the builder pattern in Rust using the `PngOptions` struct. It defines fields for PNG compression and filtering options and implements the `Default` trait for sensible defaults. Users can then create an instance with default values and override specific options as needed. ```rust // From src/png/mod.rs #[derive(Debug, Clone)] pub struct PngOptions { pub compression_level: u8, pub filter_strategy: FilterStrategy, pub optimize_alpha: bool, pub reduce_color_type: bool, // ... } impl Default for PngOptions { fn default() -> Self { Self { compression_level: 2, filter_strategy: FilterStrategy::AdaptiveFast, optimize_alpha: false, reduce_color_type: false, // ... } } } ``` -------------------------------- ### Rust Borrowing Rules in Compression Source: https://github.com/leerob/pixo/blob/main/docs/introduction-to-rust.md Shows how Rust's borrowing rules are applied in the `compress_into` function. It uses immutable borrows for input data (`&[u8]`) and mutable borrows for the output token vector (`&mut Vec`) and the compressor instance (`&mut self`), ensuring data safety. ```rust // From src/compress/lz77.rs pub fn compress_into(&mut self, data: &[u8], tokens: &mut Vec) { // data is borrowed immutably (&[u8]) // tokens is borrowed mutably (&mut Vec) // self is borrowed mutably (&mut self) } ``` -------------------------------- ### Unfiltering (Reverse Predictions) for Images Source: https://github.com/leerob/pixo/blob/main/docs/decoding.md Explains how to reverse image filtering predictions to reconstruct original pixel data. Each row starts with a filter type, and the decoder adds back the prediction based on the filter type and neighboring pixels (A=left, B=above, C=upper-left). ```text Filter | Encoding (stored value) | Decoding (reconstruction) | | None (0) | X | X | | Sub (1) | X - A | stored + A | | Up (2) | X - B | stored + B | | Average (3) | X - floor((A+B)/2) | stored + floor((A+B)/2) | | Paeth (4) | X - Paeth(A,B,C) | stored + Paeth(A,B,C) | Where A = left pixel, B = above pixel, C = upper-left pixel. Worked example (Sub filter): Stored values: [1, 100, 2, 2, 2, 2, 2, 2] ↑ filter type = Sub ↑ first pixel (no left neighbor, A=0) Decode: Pixel 0: 100 + 0 = 100 Pixel 1: 2 + 100 = 102 Pixel 2: 2 + 102 = 104 Pixel 3: 2 + 104 = 106 ... Reconstructed: 100, 102, 104, 106, 108, 110, 112, 114 ``` -------------------------------- ### Run Benchmarks in Rust Source: https://github.com/leerob/pixo/blob/main/docs/crate.md Initiate benchmark tests for the Rust project using the Cargo bench command. Detailed comparisons can be found in the benchmarks documentation. ```bash cargo bench ``` -------------------------------- ### Build Pixo with Parallelism Enabled (Default) Source: https://github.com/leerob/pixo/blob/main/benches/BENCHMARKS.md Builds the Pixo project with default settings, which include enabling parallel processing for multi-core acceleration. This is the standard build command. ```bash cargo build --release ``` -------------------------------- ### High-Quality Image Resizing with Lanczos3 (Rust) Source: https://context7.com/leerob/pixo/llms.txt Resizes an image to different dimensions using the Lanczos3 filter for the highest quality resampling. This is suitable for applications where image fidelity is critical. The example uses the `pixo` library's resize functionality. ```rust use pixo::{resize, ColorType, ResizeAlgorithm, ResizeOptions}; fn main() -> pixo::Result<()> { // 1024x768 RGBA image let pixels = vec![128u8; 1024 * 768 * 4]; let options = ResizeOptions::builder(1024, 768) .dst(512, 384) // target dimensions .color_type(ColorType::Rgba) .algorithm(ResizeAlgorithm::Lanczos3) // highest quality .build(); let resized = resize::resize(&pixels, &options)?; assert_eq!(resized.len(), 512 * 384 * 4); Ok(()) } ```