Expand description
A Rust library for converting between different betting odds formats.
This crate provides functionality to convert between American, Decimal, and Fractional betting odds formats, along with implied probability calculations and robust error handling.
§Examples
use odds_converter::Odds;
// Create odds in different formats
let american = Odds::new_american(150);
let decimal = Odds::new_decimal(2.5);
let fractional = Odds::new_fractional(3, 2);
// Convert between formats
let decimal_from_american = american.to_decimal().unwrap();
let american_from_decimal = decimal.to_american().unwrap();
// Calculate implied probability
let probability = decimal.implied_probability().unwrap();
// Parse from strings
let odds: Odds = "+150".parse().unwrap();Structs§
- Odds
- The main odds structure that can hold any of the three odds formats.
Enums§
- Odds
Error - Errors that can occur when working with betting odds.
- Odds
Format - Represents the different formats of betting odds.