From f84557f3d9e06ce9f94e4b98d88b8b5cf7cf91f2 Mon Sep 17 00:00:00 2001 From: Rick van Assen Date: Thu, 29 Aug 2024 15:49:38 +0200 Subject: [PATCH] feat: make height and width optional --- Cargo.toml | 2 +- src/spec.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 63f82b8..8f03a7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oembed-rs" -version = "0.0.6" +version = "0.0.7" edition = "2021" license = "MIT" readme = "README.md" diff --git a/src/spec.rs b/src/spec.rs index adb2a7d..526355b 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -57,8 +57,8 @@ pub enum EmbedType { #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct Video { pub html: String, - pub width: i32, - pub height: i32, + pub width: Option, + pub height: Option, } /// Photo type @@ -68,8 +68,8 @@ pub struct Video { #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct Photo { pub url: String, - pub width: i32, - pub height: i32, + pub width: Option, + pub height: Option, } /// Rich type @@ -79,7 +79,7 @@ pub struct Photo { #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct Rich { pub html: String, - pub width: i32, + pub width: Option, pub height: Option, } @@ -126,8 +126,8 @@ mod tests { response.oembed_type, EmbedType::Photo(Photo { url: "https://example.com/photo.jpg".to_string(), - width: 100, - height: 50 + width: Some(100), + height: Some(50) }) ) }