File size: 1,870 Bytes
3374e90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
//! Type conversion traits and utilities for wire types.
//!
//! This module provides helpers for converting between different
//! representations of the same data types. The actual WIT → FlatBuffer
//! conversion is in `bex_runtime::convert` since it depends on `bex_core`.

// Re-export all wire types for convenience
pub use crate::bex_common_generated::bex::wire::*;
pub use crate::bex_media_generated::bex::wire::*;
pub use crate::bex_stream_generated::bex::wire::*;
pub use crate::bex_event_generated::bex::wire::*;

/// Get the variant name of a `MediaKind` as a static string.
pub fn media_kind_name(kind: MediaKind) -> &'static str {
    match kind {
        MediaKind::Movie => "Movie",
        MediaKind::Series => "Series",
        MediaKind::Anime => "Anime",
        MediaKind::Short => "Short",
        MediaKind::Special => "Special",
        MediaKind::Documentary => "Documentary",
        MediaKind::Music => "Music",
        MediaKind::Podcast => "Podcast",
        MediaKind::Book => "Book",
        MediaKind::Live => "Live",
        MediaKind::Unknown => "Unknown",
        _ => "Unknown",
    }
}

/// Get the variant name of a `Status` as a static string.
pub fn status_name(status: Status) -> &'static str {
    match status {
        Status::Unknown => "Unknown",
        Status::Upcoming => "Upcoming",
        Status::Ongoing => "Ongoing",
        Status::Completed => "Completed",
        Status::Cancelled => "Cancelled",
        Status::Paused => "Paused",
        _ => "Unknown",
    }
}

/// Get the variant name of a `StreamFormat` as a static string.
pub fn stream_format_name(fmt: StreamFormat) -> &'static str {
    match fmt {
        StreamFormat::Hls => "Hls",
        StreamFormat::Dash => "Dash",
        StreamFormat::Progressive => "Progressive",
        StreamFormat::Unknown => "Unknown",
        _ => "Unknown",
    }
}