Type Alias Result

Source
pub type Result<T> = Result<T, Error>;
Expand description

Result type alias for CodeBank operations.

This type is used throughout the CodeBank library to handle operations that can fail with a [Error].

§Examples

use codebank::{Result, Error};
use std::path::PathBuf;

fn example_operation() -> Result<String> {
    // Simulate a failing operation
    Err(Error::FileNotFound(PathBuf::from("missing.rs")))
}

// Handle the result
match example_operation() {
    Ok(content) => println!("Success: {}", content),
    Err(e) => println!("Operation failed: {}", e),
}

Aliased Type§

enum Result<T> {
    Ok(T),
    Err(Error),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Error)

Contains the error value