Skip to content

Add a method to convert a vector of Ascii to a string slice without copying #6120

Description

@pcwalton

As it says.

Activity

  1. Kimundi commented on Apr 30, 2013

    @Kimundi
    Contributor

    The problem is that that's not generally possible without reqiring that the Ascii vector is one random byte longer than the slice you want. A str slice is one hidden byte longer than a vec slice.

  2. Kimundi commented on Apr 30, 2013

    @Kimundi
    Contributor

    One way to solve this would be to turn ~[Ascii] into an own type AsciiStr, which holds the invariant that its always null terminated. Or we could just say that a [Ascii] may be optionally null terminated, that a trailing null is never considerd part of the string it represents, and that certain operations reqire it.

  3. emberian commented on Jul 12, 2013

    @emberian
    Contributor

    I think #7599 enables this cleanly?

  4. Kimundi commented on Jul 12, 2013

    @Kimundi
    Contributor

    @cmr I'm not sure how that Issue is related.

  5. emberian commented on Jul 12, 2013

    @emberian
    Contributor

    @Kimundi err yeah, nevermind, sorry

  6. huonw commented on Jul 13, 2013

    @huonw
    Contributor

    @erickt was experimenting with removing the null-terminator on ~strs, which would make this possible. (Preferably by implementing the std::str::Str trait.)

  7. huonw commented on Nov 7, 2013

    @huonw
    Contributor

    Triage: null terminators are gone, so this will be fixed when #10333 lands.

  8. added a commit that references this issue on Nov 8, 2013
    27eb85d
  9. added a commit that references this issue on Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions