Skip to content

Why is the RString API using Rust's String/str instead of Vec<u8>/[u8]? #97

Open
@CodesInChaos

Description

@CodesInChaos

My understanding is that Ruby's strings are sequences of arbitrary bytes, even if the associated encoding is UTF-8. So the natural mapping to Rust would be as [u8] and Vec<u8> instead of str and String for most purposes. A couple of helpers using str should be fine (e.g. the from_utf8 function).

Functions which convert a ruby string to &str or String without verifying UTF-8 validity must be marked unsafe, otherwise they're unsound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions