Skip to content

Commit f84557f

Browse files
committed
feat: make height and width optional
1 parent ac70b6f commit f84557f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "oembed-rs"
3-
version = "0.0.6"
3+
version = "0.0.7"
44
edition = "2021"
55
license = "MIT"
66
readme = "README.md"

src/spec.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ pub enum EmbedType {
5757
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
5858
pub struct Video {
5959
pub html: String,
60-
pub width: i32,
61-
pub height: i32,
60+
pub width: Option<i32>,
61+
pub height: Option<i32>,
6262
}
6363

6464
/// Photo type
@@ -68,8 +68,8 @@ pub struct Video {
6868
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
6969
pub struct Photo {
7070
pub url: String,
71-
pub width: i32,
72-
pub height: i32,
71+
pub width: Option<i32>,
72+
pub height: Option<i32>,
7373
}
7474

7575
/// Rich type
@@ -79,7 +79,7 @@ pub struct Photo {
7979
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
8080
pub struct Rich {
8181
pub html: String,
82-
pub width: i32,
82+
pub width: Option<i32>,
8383
pub height: Option<i32>,
8484
}
8585

@@ -126,8 +126,8 @@ mod tests {
126126
response.oembed_type,
127127
EmbedType::Photo(Photo {
128128
url: "https://example.com/photo.jpg".to_string(),
129-
width: 100,
130-
height: 50
129+
width: Some(100),
130+
height: Some(50)
131131
})
132132
)
133133
}

0 commit comments

Comments
 (0)