framesmith 0.1.0

A Rust library for controlling Samsung Frame TVs over the local network
Documentation
use crate::types::ArtImageBuilder;

pub struct ArtImage {
    pub(crate) data: Vec<u8>,
    pub(crate) file_type: ArtImageFileType,
    pub(crate) width: u32,
    pub(crate) height: u32,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ArtImageFileType {
    Jpeg,
    Png,
}

impl ArtImageFileType {
    pub(crate) fn as_str(&self) -> &'static str {
        match self {
            Self::Jpeg => "jpg",
            Self::Png => "png",
        }
    }
}

impl ArtImage {
    pub fn builder() -> ArtImageBuilder {
        ArtImageBuilder::new()
    }

    pub fn data(&self) -> &[u8] {
        &self.data
    }

    pub fn width(&self) -> u32 {
        self.width
    }

    pub fn height(&self) -> u32 {
        self.height
    }
}