Implement SQL Script as a newtype tuple struct
This commit is contained in:
parent
1f05b32f93
commit
42fa91c7bd
1 changed files with 9 additions and 3 deletions
|
@ -1,16 +1,22 @@
|
|||
use crate::sql::error::IResult;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use std::ops::Deref;
|
||||
use std::str;
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize)]
|
||||
pub struct Script {
|
||||
pub value: String,
|
||||
pub struct Script(pub String);
|
||||
|
||||
impl Deref for Script {
|
||||
type Target = String;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Script {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "\"{}\"", self.value)
|
||||
write!(f, "\"{}\"", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue