pub fn try_vec_raw_into_vec_real<RealType: RealScalar, RawReal: RawRealTrait>(
vec: Vec<RawReal>,
) -> Result<Vec<RealType>, RawRealConversionError<RawReal, RealType::RawReal>>where
RealType::RawReal: TryConvertFromRawReal<RawReal>,Expand description
Attempts to convert a vector of raw real values into a vector of the specified real scalar type.
This function provides a fallible conversion that validates each input value according to the target type’s validation policy. If any value fails validation, the entire operation fails and returns an error.
§Parameters
vec: A vector of raw real values (any type implementingRawRealTraitand convertible intoRealType::RawReal) to convert
§Return Value
Ok(Vec<RealType>): If all values can be successfully converted and validatedErr(RawRealConversionError): If any value fails validation, containing details about the failure
§Usage Examples
§Successful Conversion
use num_valid::*;
let input = vec![1.0, -2.5, 3.14159];
let result = try_vec_raw_into_vec_real::<RealNative64StrictFinite, _>(input);
assert!(result.is_ok());
let validated_vec = result.unwrap();
assert_eq!(validated_vec.len(), 3);
assert_eq!(validated_vec[0].as_raw_scalar_ref(), &1.0);§Failed Conversion
use num_valid::*;
let input = vec![1.0, f64::NAN, 3.0]; // Contains NaN
let result = try_vec_raw_into_vec_real::<RealNative64StrictFinite, _>(input);
assert!(result.is_err()); // Fails due to NaN value