amazon_spapi/models/shipping/weight.rs
1/*
2 * Selling Partner API for Shipping
3 *
4 * Provides programmatic access to Amazon Shipping APIs. **Note:** If you are new to the Amazon Shipping API, refer to the latest version of <a href=\"https://developer-docs.amazon.com/amazon-shipping/docs/shipping-api-v2-reference\">Amazon Shipping API (v2)</a> on the <a href=\"https://developer-docs.amazon.com/amazon-shipping/\">Amazon Shipping Developer Documentation</a> site.
5 *
6 * The version of the OpenAPI document: v1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Weight : The weight.
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.
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 = "g")]
38 G,
39 #[serde(rename = "kg")]
40 Kg,
41 #[serde(rename = "oz")]
42 Oz,
43 #[serde(rename = "lb")]
44 Lb,
45}
46
47impl Default for Unit {
48 fn default() -> Unit {
49 Self::G
50 }
51}
52