-
Notifications
You must be signed in to change notification settings - Fork 244
/
model.rs
74 lines (74 loc) · 3.3 KB
/
model.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>An object that identifies an item.</p>
/// <p>The and APIs return a list of <code>PredictedItem</code>s.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct PredictedItem {
/// <p>The recommended item ID.</p>
pub item_id: std::option::Option<std::string::String>,
/// <p>A numeric representation of the model's certainty that the item will be the next user selection. For more information on scoring logic, see <code>how-scores-work</code>.</p>
pub score: std::option::Option<f64>,
}
impl PredictedItem {
/// <p>The recommended item ID.</p>
pub fn item_id(&self) -> std::option::Option<&str> {
self.item_id.as_deref()
}
/// <p>A numeric representation of the model's certainty that the item will be the next user selection. For more information on scoring logic, see <code>how-scores-work</code>.</p>
pub fn score(&self) -> std::option::Option<f64> {
self.score
}
}
impl std::fmt::Debug for PredictedItem {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("PredictedItem");
formatter.field("item_id", &self.item_id);
formatter.field("score", &self.score);
formatter.finish()
}
}
/// See [`PredictedItem`](crate::model::PredictedItem)
pub mod predicted_item {
/// A builder for [`PredictedItem`](crate::model::PredictedItem)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) item_id: std::option::Option<std::string::String>,
pub(crate) score: std::option::Option<f64>,
}
impl Builder {
/// <p>The recommended item ID.</p>
pub fn item_id(mut self, input: impl Into<std::string::String>) -> Self {
self.item_id = Some(input.into());
self
}
/// <p>The recommended item ID.</p>
pub fn set_item_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.item_id = input;
self
}
/// <p>A numeric representation of the model's certainty that the item will be the next user selection. For more information on scoring logic, see <code>how-scores-work</code>.</p>
pub fn score(mut self, input: f64) -> Self {
self.score = Some(input);
self
}
/// <p>A numeric representation of the model's certainty that the item will be the next user selection. For more information on scoring logic, see <code>how-scores-work</code>.</p>
pub fn set_score(mut self, input: std::option::Option<f64>) -> Self {
self.score = input;
self
}
/// Consumes the builder and constructs a [`PredictedItem`](crate::model::PredictedItem)
pub fn build(self) -> crate::model::PredictedItem {
crate::model::PredictedItem {
item_id: self.item_id,
score: self.score,
}
}
}
}
impl PredictedItem {
/// Creates a new builder-style object to manufacture [`PredictedItem`](crate::model::PredictedItem)
pub fn builder() -> crate::model::predicted_item::Builder {
crate::model::predicted_item::Builder::default()
}
}