atomic_lti/deep_linking/
link.rs

1use super::shared::{Embed, Icon, Iframe, Thumbnail, Window};
2use serde::{Deserialize, Serialize};
3use serde_with::skip_serializing_none;
4
5#[skip_serializing_none]
6#[derive(Debug, Deserialize, Serialize, Clone)]
7pub struct Link {
8  #[serde(rename = "type")]
9  #[serde(default = "default_type")]
10  pub type_: String,
11  pub url: String,
12  pub title: Option<String>,
13  pub text: Option<String>,
14  pub icon: Option<Icon>,
15  pub thumbnail: Option<Thumbnail>,
16  pub embed: Option<Embed>,
17  pub window: Option<Window>,
18  pub iframe: Option<Iframe>,
19}
20
21impl Default for Link {
22  fn default() -> Self {
23    Self {
24      type_: "link".to_string(),
25      url: "".to_string(),
26      title: None,
27      text: None,
28      icon: None,
29      thumbnail: None,
30      embed: None,
31      window: None,
32      iframe: None,
33    }
34  }
35}
36
37fn default_type() -> String {
38  "link".to_string()
39}