Skip to content

Impl Type, Encode, Decode for AsRef<str> #1347

Closed
@malobre

Description

@malobre

Currently postgres' Text (and other db equivalents) is compatible with:

  • &'_ str
  • String
  • [&'_ str]
  • [String]
  • Vec<&'_ str>
  • Vec<String>

Instead, I suggest implementing Type, Encode & Decode for:

  • T: AsRef<str>
  • [T] where T: AsRef<str>
  • Vec<T> where T: AsRef<str>

This would simplify the code while allowing more types, such as Box<str> or Cow<'_, str>, to be used with Text.

I haven't taken a look at other SQL types but this suggestion could apply there too.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions