@@ -39,7 +39,7 @@ pub enum TryFromDatumError {
39
39
///
40
40
/// If implementing this, also implement `IntoDatum` for the reverse
41
41
/// conversion.
42
- pub trait FromDatum {
42
+ pub trait FromDatum : Sized {
43
43
/// Should a type OID be fetched when calling `from_datum`?
44
44
const GET_TYPOID : bool = false ;
45
45
@@ -54,10 +54,7 @@ pub trait FromDatum {
54
54
///
55
55
/// If, however, you're providing an arbitrary datum value, it needs to be considered unsafe
56
56
/// and that unsafeness should be propagated through your API.
57
- unsafe fn from_datum ( datum : pg_sys:: Datum , is_null : bool ) -> Option < Self >
58
- where
59
- Self : Sized ,
60
- {
57
+ unsafe fn from_datum ( datum : pg_sys:: Datum , is_null : bool ) -> Option < Self > {
61
58
FromDatum :: from_polymorphic_datum ( datum, is_null, pg_sys:: InvalidOid )
62
59
}
63
60
@@ -71,9 +68,7 @@ pub trait FromDatum {
71
68
datum : pg_sys:: Datum ,
72
69
is_null : bool ,
73
70
typoid : pg_sys:: Oid ,
74
- ) -> Option < Self >
75
- where
76
- Self : Sized ;
71
+ ) -> Option < Self > ;
77
72
78
73
/// Default implementation switched to the specified memory context and then simply calls
79
74
/// `FromDatum::from_datum(...)` from within that context.
@@ -93,10 +88,7 @@ pub trait FromDatum {
93
88
datum : pg_sys:: Datum ,
94
89
is_null : bool ,
95
90
typoid : pg_sys:: Oid ,
96
- ) -> Option < Self >
97
- where
98
- Self : Sized ,
99
- {
91
+ ) -> Option < Self > {
100
92
memory_context. switch_to ( |_| FromDatum :: from_polymorphic_datum ( datum, is_null, typoid) )
101
93
}
102
94
@@ -114,7 +106,7 @@ pub trait FromDatum {
114
106
type_oid : pg_sys:: Oid ,
115
107
) -> Result < Option < Self > , TryFromDatumError >
116
108
where
117
- Self : Sized + IntoDatum ,
109
+ Self : IntoDatum ,
118
110
{
119
111
if !is_binary_coercible :: < Self > ( type_oid) {
120
112
Err ( TryFromDatumError :: IncompatibleTypes {
@@ -137,7 +129,7 @@ pub trait FromDatum {
137
129
type_oid : pg_sys:: Oid ,
138
130
) -> Result < Option < Self > , TryFromDatumError >
139
131
where
140
- Self : Sized + IntoDatum ,
132
+ Self : IntoDatum ,
141
133
{
142
134
if !is_binary_coercible :: < Self > ( type_oid) {
143
135
Err ( TryFromDatumError :: IncompatibleTypes {
0 commit comments