#[derive(Debug, Clone)]
pub struct JsScript(String);
impl JsScript {
pub fn new(script: impl Into<String>) -> Self {
JsScript(script.into())
}
pub fn as_str(&self) -> &str {
&self.0
}
}
impl From<String> for JsScript {
fn from(script: String) -> Self {
JsScript(script)
}
}
impl From<&str> for JsScript {
fn from(script: &str) -> Self {
JsScript(script.to_string())
}
}
impl From<JsScript> for String {
fn from(script: JsScript) -> Self {
script.0
}
}
impl AsRef<str> for JsScript {
fn as_ref(&self) -> &str {
&self.0
}
}