pub trait TryConvertFromRawReal<RawRealIn: RawRealTrait>: RawRealTrait {
// Required method
fn try_convert_from_raw_real(
value_in: RawRealIn,
precision_out: u32,
) -> Result<Self, RawRealConversionError<RawRealIn, Self>>;
}Expand description
Conversion contract from one raw real type to another.
This trait is the low-level engine behind RawRealTrait::try_convert.
Implementors define how to convert from RawRealIn into Self, including
precision handling and exact representability guarantees.
§Design
RawRealInis the input raw real type.Selfis the output raw real type.precision_outis always interpreted by the output type (Self).
§Error Semantics
Implementations should map failures to RawRealConversionError:
- input validation failures ->
InputValidation - output validation failures ->
OutputValidation - invalid requested precision for fixed-precision targets ->
InvalidOutputPrecision - exactness loss after conversion ->
NonRepresentableExactly
Required Methods§
Sourcefn try_convert_from_raw_real(
value_in: RawRealIn,
precision_out: u32,
) -> Result<Self, RawRealConversionError<RawRealIn, Self>>
fn try_convert_from_raw_real( value_in: RawRealIn, precision_out: u32, ) -> Result<Self, RawRealConversionError<RawRealIn, Self>>
Performs raw-real conversion with explicit output precision.
§Parameters
value_in: input raw value to be converted.precision_out: requested output precision interpreted bySelf.
§Returns
Ok(Self)when conversion is valid and exact under the trait contract.Err(RawRealConversionError<RawRealIn, Self>)otherwise.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl TryConvertFromRawReal<Float> for Float
Available on crate feature rug only.
impl TryConvertFromRawReal<Float> for Float
Available on crate feature
rug only.