mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 07:45:30 +00:00
remove DecodeOwned
This commit is contained in:
parent
fa4138b25c
commit
aa1cb24de9
@ -10,14 +10,3 @@ where
|
||||
{
|
||||
fn decode(value: <DB as HasRawValue<'de>>::RawValue) -> crate::Result<DB, Self>;
|
||||
}
|
||||
|
||||
/// A type that can be decoded without borrowing from the connection.
|
||||
pub trait DecodeOwned<DB: Database>: for<'de> Decode<'de, DB> {}
|
||||
|
||||
impl<DB, T> DecodeOwned<DB> for T
|
||||
where
|
||||
DB: Database,
|
||||
T: 'static,
|
||||
T: for<'de> Decode<'de, DB>,
|
||||
{
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Encoding and decoding of Postgres arrays.
|
||||
|
||||
use crate::database::Database;
|
||||
use crate::decode::{Decode, DecodeOwned};
|
||||
use crate::decode::Decode;
|
||||
use crate::encode::Encode;
|
||||
use crate::postgres::database::Postgres;
|
||||
use crate::postgres::types::raw::{PgArrayDecoder, PgArrayEncoder};
|
||||
@ -37,7 +37,7 @@ where
|
||||
impl<'de, T> Decode<'de, Postgres> for Vec<T>
|
||||
where
|
||||
T: 'de,
|
||||
T: DecodeOwned<Postgres>,
|
||||
T: for<'arr> Decode<'arr, Postgres>,
|
||||
[T]: Type<Postgres>,
|
||||
T: Type<Postgres>,
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::decode::DecodeOwned;
|
||||
use crate::decode::Decode;
|
||||
use crate::encode::{Encode, IsNull};
|
||||
use crate::io::{Buf, BufMut};
|
||||
use crate::postgres::types::raw::sequence::PgSequenceDecoder;
|
||||
@ -91,7 +91,7 @@ pub(crate) struct PgArrayDecoder<'de, T> {
|
||||
|
||||
impl<'de, T> PgArrayDecoder<'de, T>
|
||||
where
|
||||
T: DecodeOwned<Postgres>,
|
||||
T: for<'arr> Decode<'arr, Postgres>,
|
||||
T: Type<Postgres>,
|
||||
{
|
||||
pub(crate) fn new(value: Option<PgValue<'de>>) -> crate::Result<Postgres, Self> {
|
||||
@ -157,8 +157,7 @@ where
|
||||
|
||||
impl<'de, T> Iterator for PgArrayDecoder<'de, T>
|
||||
where
|
||||
T: 'de,
|
||||
T: DecodeOwned<Postgres>,
|
||||
T: for<'arr> Decode<'arr, Postgres>,
|
||||
T: Type<Postgres>,
|
||||
{
|
||||
type Item = crate::Result<Postgres, T>;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::decode::DecodeOwned;
|
||||
use crate::decode::Decode;
|
||||
use crate::encode::{Encode, IsNull};
|
||||
use crate::io::Buf;
|
||||
use crate::postgres::types::raw::sequence::PgSequenceDecoder;
|
||||
@ -78,7 +78,7 @@ impl<'de> PgRecordDecoder<'de> {
|
||||
#[inline]
|
||||
pub fn decode<T>(&mut self) -> crate::Result<Postgres, T>
|
||||
where
|
||||
T: DecodeOwned<Postgres>,
|
||||
T: for<'rec> Decode<'rec, Postgres>,
|
||||
T: Type<Postgres>,
|
||||
{
|
||||
self.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::decode::DecodeOwned;
|
||||
use crate::decode::Decode;
|
||||
use crate::io::Buf;
|
||||
use crate::postgres::{PgValue, Postgres};
|
||||
use crate::types::Type;
|
||||
@ -37,7 +37,7 @@ impl<'de> PgSequenceDecoder<'de> {
|
||||
|
||||
pub(crate) fn decode<T>(&mut self) -> crate::Result<Postgres, Option<T>>
|
||||
where
|
||||
T: DecodeOwned<Postgres>,
|
||||
T: for<'seq> Decode<'seq, Postgres>,
|
||||
T: Type<Postgres>,
|
||||
{
|
||||
match self.value {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::decode::{Decode, DecodeOwned};
|
||||
use crate::decode::Decode;
|
||||
use crate::postgres::protocol::TypeId;
|
||||
use crate::postgres::row::PgValue;
|
||||
use crate::postgres::types::raw::PgRecordDecoder;
|
||||
@ -40,7 +40,7 @@ macro_rules! impl_pg_record_for_tuple {
|
||||
where
|
||||
$($T: 'de,)+
|
||||
$($T: Type<Postgres>,)+
|
||||
$($T: DecodeOwned<Postgres>,)+
|
||||
$($T: for<'tup> Decode<'tup, Postgres>,)+
|
||||
{
|
||||
fn decode(value: Option<PgValue<'de>>) -> crate::Result<Postgres, Self> {
|
||||
let mut decoder = PgRecordDecoder::new(value)?;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![allow(unused_imports)]
|
||||
|
||||
#[cfg(not(any(feature = "runtime-tokio", feature = "runtime-async-std")))]
|
||||
compile_error!("one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user