use std::ops::{Deref, DerefMut};
use serde::{Deserialize, Serialize};
#[cfg_attr(
all(feature = "schemars", not(feature = "test")),
derive(schemars::JsonSchema)
)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
pub struct Css(String);
impl Css {
pub fn new() -> Self {
Self::default()
}
pub fn from_string(css: String) -> Self {
Self(css)
}
pub fn into_inner(self) -> String {
self.0
}
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Deref for Css {
type Target = String;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for Css {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<String> for Css {
fn from(inner: String) -> Self {
Self(inner)
}
}
impl From<&str> for Css {
fn from(s: &str) -> Self {
Self(s.to_owned())
}
}