Module error

Module error 

Source
Expand description

§Error

This module defines the errors that can occur when using the library.

§Example

Handling errors from the library.

use mini_oled::error::MiniOledError;

fn check_error(result: Result<(), MiniOledError>) {
    match result {
        Ok(_) => {},
        Err(MiniOledError::CommandBufferSizeError) => {
            // Handle command buffer overflow
        },
        Err(MiniOledError::DataBufferSizeError) => {
            // Handle data buffer overflow
        },
        Err(MiniOledError::I2cError(_)) => {
            // Handle I2C communication error
        },
        Err(MiniOledError::SpiBusError(_)) => {
            // Handle SPI communication error
        },
    }
}

Enums§

MiniOledError