]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/traits/self-without-lifetime-constraint.rs
4 #[derive(Copy, Clone, Debug, PartialEq)]
5 pub enum ValueRef
<'a
> {
13 impl<'a
> ValueRef
<'a
> {
14 pub fn as_str(&self) -> FromSqlResult
<&'a
str, &'a
&'a
str> {
16 ValueRef
::Text(t
) => {
17 std
::str::from_utf8(t
).map_err(|_
| FromSqlError
::InvalidType
).map(|x
| (x
, &x
))
19 _
=> Err(FromSqlError
::InvalidType
),
26 pub enum FromSqlError
{
30 impl fmt
::Display
for FromSqlError
{
31 fn fmt(&self, f
: &mut fmt
::Formatter
<'_
>) -> fmt
::Result
{
32 write
!(f
, "InvalidType")
36 impl Error
for FromSqlError {}
38 pub type FromSqlResult
<T
, K
> = Result
<(T
, K
), FromSqlError
>;
40 pub trait FromSql
: Sized
{
41 fn column_result(value
: ValueRef
<'_
>) -> FromSqlResult
<Self, &Self>;
44 impl FromSql
for &str {
45 fn column_result(value
: ValueRef
<'_
>) -> FromSqlResult
<&str, &&str> {
46 //~^ ERROR `impl` item signature doesn't match `trait` item signature
52 println
!("{}", "Hello World");