use tokio_postgres::Error; use crate::{Client, Statement}; mod sealed { pub trait Sealed {} } pub trait Query: sealed::Sealed { #[doc(hidden)] fn __statement(&self, client: &mut Client) -> Result; } impl sealed::Sealed for str {} impl Query for str { fn __statement(&self, client: &mut Client) -> Result { client.prepare(self) } } impl sealed::Sealed for Statement {} impl Query for Statement { fn __statement(&self, _: &mut Client) -> Result { Ok(self.clone()) } }