You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: error.rs
    path of file: ./repos/tetra/src
    
    the code of the file until where you have to start completion: //! Functions and types relating to error handling.

use std::error::Error;
use std::fmt::{self, Display, Formatter};
use std::
    
    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
        match self {
            TetraError::PlatformError(msg) => {
                write!(f, "An error was thrown by the platform: {}", msg)
            }
            TetraError::FailedToLoadAsset { path, .. } => {
                write!(f, "Failed to load asset from {}", path.to_string_lossy())
            }
            TetraError::InvalidColor => write!(f, "Invalid color"),
            TetraError::InvalidTexture(_) => write!(f, "Invalid texture data"),
            TetraError::InvalidShader(msg) => write!(f, "Invalid shader source: {}", msg),
            TetraError::InvalidFont => write!(f, "Invalid font data"),
            #[cfg(feature = "audio")]
            TetraError::InvalidSound(_) => write!(f, "Invalid sound data"),
            TetraError::NotEnoughData { expected, actual } => write!(
                f,
                "Not enough data was provided to fill a buffer - expected {}, found {}.",
                expected, actual
            ),
            TetraError::FailedToChangeDisplayMode(msg) => {
                write!(f, "Failed to change display mode: {}", msg)
            }
            TetraError::NoAudioDevice => write!(f, "No audio device available for playback"),
            TetraError::TessellationError(_) => {
                write!(f, "An error occurred while tessellating a shape")
            }
        }
    }