Skip to content

Commit 08b7c65

Browse files
committed
remove as_string
1 parent 6c407d3 commit 08b7c65

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

postgres-types/src/lib.rs

+4-13
Original file line numberDiff line numberDiff line change
@@ -772,17 +772,12 @@ pub trait ToSql: fmt::Debug {
772772

773773
/// Specify the encode format
774774
fn encode_format(&self) -> i16 { 1 }
775-
776-
/// return string representation
777-
fn as_string(&self) -> String {
778-
panic!("as_string not implemented for {:?}", self)
779-
}
780775
}
781776

782777

783778
/// A Wrapper type used for sending query parameters encoded as unknown.
784779
#[derive(Debug)]
785-
pub struct Unknown<'a>(pub &'a (dyn ToSql + Sync));
780+
pub struct Unknown<'a>(pub &'a str);
786781

787782
impl ToSql for Unknown<'_> {
788783
fn to_sql(
@@ -792,7 +787,7 @@ impl ToSql for Unknown<'_> {
792787
) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
793788
match *self {
794789
Unknown(val) => {
795-
types::text_to_sql(&val.as_string(), out);
790+
types::text_to_sql(val, out);
796791
Ok(IsNull::No)
797792
}
798793
}
@@ -939,7 +934,7 @@ impl<'a> ToSql for &'a str {
939934
_ => false,
940935
}
941936
}
942-
fn as_string(&self) -> String { self.to_string() }
937+
943938
to_sql_checked!();
944939
}
945940

@@ -963,7 +958,7 @@ impl ToSql for String {
963958
fn accepts(ty: &Type) -> bool {
964959
<&str as ToSql>::accepts(ty)
965960
}
966-
fn as_string(&self) -> String { self.clone() }
961+
967962
to_sql_checked!();
968963
}
969964

@@ -978,10 +973,6 @@ macro_rules! simple_to {
978973
Ok(IsNull::No)
979974
}
980975

981-
fn as_string(&self) -> String {
982-
format!("{}", &self)
983-
}
984-
985976
accepts!($($expected),+);
986977

987978
to_sql_checked!();

0 commit comments

Comments
 (0)