Compilation error: serde option for vectors or options of decimals
- Dominant language
- Rust
- Stars
- 7
- Forks
- 11
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 5
Description
This affects
* `specification/cost-management/resource-manager/Microsoft.CostManagement/CostManagement`
* `specification/consumption/resource-manager/Microsoft.Consumption/Consumption`
Code:
```rs
/// On-demand charges between firstConsumptionDate and lastConsumptionDate that were used for computing benefit recommendations.
#[derive(Clone, Default, Deserialize, SafeDebug, Serialize)]
#[non_exhaustive]
pub struct RecommendationUsageDetails {
/// On-demand charges for each hour between firstConsumptionDate and lastConsumptionDate that were used for computing benefit
/// recommendations.
///
/// Operational visibility: Read
#[serde(
skip_serializing_if = "Option::is_none",
with = "rust_decimal::serde::float_option"
)]
pub charges: Option>,
/// The grain of the usage. Supported values: 'Hourly'
#[serde(rename = "usageGrain", skip_serializing_if = "Option::is_none")]
pub usage_grain: Option,
}
```
Error:
```
error[E0308]: `?` operator has incompatible types
--> spec\rmCostMgmt\src\generated\models\models.rs:3795:16
|
3795 | with = "rust_decimal::serde::float_option"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Option>`, found `Option`
|
= note: `?` operator cannot convert from `std::option::Option` to `std::option::Option>`
= note: expected enum `std::option::Option>`
found enum `std::option::Option`
```
Similar case:
```rs
/// Recommended quality for reserved instances.
///
/// Operational visibility: Read
#[serde(rename = "recommendedQuantity", with = "rust_decimal::serde::float")]
pub recommended_quantity: &'a Option,
```
Contributor guide
Assessment
This issue has not been assessed yet.