Search code examples
rustrust-sqlx

Understanding the where clause in sqlx FromRow Macro Expansion


I don't understand line 3 in the code below. It is a macro expansion of the FromRow trait in sqlx. I through that 'a denoted a lifetime? It seems in this expansion it is being treated as a type and constrained? What does this line mean?

       impl<'a, R: ::sqlx::Row> ::sqlx::FromRow<'a, R> for LitRel
         where
         &'a ::std::primitive::str: ::sqlx::ColumnIndex<R>, //<--- ?
         String: ::sqlx::decode::Decode<'a, R::Database>,
         String: ::sqlx::types::Type<R::Database>,

Solution

  • It looks to me &'a ::std::primitive::str together is a type, string slice, and 'a is its lifetime.