amazon_spapi/models/shipping_v2/
weight.rs

1/*
2 * Amazon Shipping API
3 *
4 * The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on Amazon-owned marketplaces as well as external channels/marketplaces. With these APIs, you can request shipping rates, create shipments, cancel shipments, and track shipments.
5 *
6 * The version of the OpenAPI document: v2
7 * Contact: swa-api-core@amazon.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Weight : The weight in the units indicated.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Weight {
17    /// The unit of measurement.
18    #[serde(rename = "unit")]
19    pub unit: Unit,
20    /// The measurement value.
21    #[serde(rename = "value")]
22    pub value: f64,
23}
24
25impl Weight {
26    /// The weight in the units indicated.
27    pub fn new(unit: Unit, value: f64) -> Weight {
28        Weight {
29            unit,
30            value,
31        }
32    }
33}
34/// The unit of measurement.
35#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
36pub enum Unit {
37    #[serde(rename = "GRAM")]
38    Gram,
39    #[serde(rename = "KILOGRAM")]
40    Kilogram,
41    #[serde(rename = "OUNCE")]
42    Ounce,
43    #[serde(rename = "POUND")]
44    Pound,
45}
46
47impl Default for Unit {
48    fn default() -> Unit {
49        Self::Gram
50    }
51}
52