Skip to content

Commit

Permalink
Merge pull request #737 from Stremio/fix/stream-item-state-derive-def…
Browse files Browse the repository at this point in the history
…ault-for-missing-fields

StreamItemState - add default for all fields that are skipped during serialization when None
  • Loading branch information
elpiel authored Nov 14, 2024
2 parents 47059b1 + 058c496 commit 645d6ec
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/types/streams/streams_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,25 @@ pub struct StreamsItem {
#[derive(Default, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StreamItemState {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subtitle_track: Option<SubtitleTrack>,
/// In milliseconds
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subtitle_delay: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Subtitles size, platform dependent units
pub subtitle_size: Option<u64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
/// Vertical offset of the subtitles, platform dependent units
pub subtitle_offset: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audio_track: Option<AudioTrack>,
/// In milliseconds
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub audio_delay: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub playback_speed: Option<f32>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub player_type: Option<String>,
}

Expand Down

0 comments on commit 645d6ec

Please sign in to comment.