#![doc = include_str!("../README.md")]
#![deny(missing_docs)]
pub use manganis_macro::*;
#[derive(Debug, PartialEq, PartialOrd, Clone, Hash)]
pub struct ImageAsset {
path: &'static str,
preview: Option<&'static str>,
caption: Option<&'static str>,
}
impl ImageAsset {
pub const fn new(path: &'static str) -> Self {
Self {
path,
preview: None,
caption: None,
}
}
pub const fn path(&self) -> &'static str {
self.path
}
pub const fn preview(&self) -> Option<&'static str> {
self.preview
}
pub const fn with_preview(self, preview: Option<&'static str>) -> Self {
Self { preview, ..self }
}
pub const fn caption(&self) -> Option<&'static str> {
self.caption
}
pub const fn with_caption(self, caption: Option<&'static str>) -> Self {
Self { caption, ..self }
}
}
impl std::ops::Deref for ImageAsset {
type Target = str;
fn deref(&self) -> &Self::Target {
self.path
}
}
impl std::fmt::Display for ImageAsset {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.path.fmt(f)
}
}
#[cfg(feature = "dioxus")]
impl dioxus_core::prelude::IntoAttributeValue for ImageAsset {
fn into_value(self) -> dioxus_core::AttributeValue {
dioxus_core::AttributeValue::Text(self.path.to_string())
}
}
#[derive(Debug, PartialEq, PartialOrd, Clone, Copy, Hash)]
pub enum ImageType {
Png,
Jpg,
Webp,
Avif,
}
pub struct ImageAssetBuilder;
impl ImageAssetBuilder {
#[allow(unused)]
pub const fn format(self, format: ImageType) -> Self {
Self
}
#[allow(unused)]
pub const fn size(self, x: u32, y: u32) -> Self {
Self
}
#[allow(unused)]
pub const fn low_quality_preview(self) -> Self {
Self
}
#[allow(unused)]
pub const fn preload(self) -> Self {
Self
}
#[allow(unused)]
pub const fn url_encoded(self) -> Self {
Self
}
}
#[allow(unused)]
pub const fn image(path: &'static str) -> ImageAssetBuilder {
ImageAssetBuilder
}
pub struct FontAssetBuilder;
impl FontAssetBuilder {
#[allow(unused)]
pub const fn families<const N: usize>(self, families: [&'static str; N]) -> Self {
Self
}
#[allow(unused)]
pub const fn weights<const N: usize>(self, weights: [u32; N]) -> Self {
Self
}
#[allow(unused)]
pub const fn text(self, text: &'static str) -> Self {
Self
}
#[allow(unused)]
pub const fn display(self, display: &'static str) -> Self {
Self
}
}
#[allow(unused)]
pub const fn font() -> FontAssetBuilder {
FontAssetBuilder
}
#[allow(unused)]
pub const fn file(path: &'static str) -> ImageAssetBuilder {
ImageAssetBuilder
}
pub trait ForMgMacro: __private::Sealed + Sync + Send {}
mod __private {
use super::*;
pub trait Sealed {}
impl Sealed for ImageAssetBuilder {}
impl Sealed for FontAssetBuilder {}
impl Sealed for &'static str {}
}
impl ForMgMacro for ImageAssetBuilder {}
impl ForMgMacro for FontAssetBuilder {}
impl ForMgMacro for &'static str {}