basis-points 0.3.2

Validated basis-points type with optional Decimal and Anchor support.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Error types for `basis-points`.
//!
//! This module defines [`BasisPointsError`], used when validation fails or when
//! conversions cannot be performed safely.

use thiserror::Error;

/// Errors returned by `BasisPoints` validation and conversions.
#[derive(Debug, Error, PartialEq, Eq)]
pub enum BasisPointsError {
    /// Basis points must be less than or equal to `10_000`.
    #[error("Basis points must be less than or equal to 10000")]
    InvalidBasisPoints,
    /// Decimal could not be safely cast to the target integer type.
    #[error("Decimal could not be safely casted to the target type")]
    ConversionFailed,
}