Skip to content

CString/ToCStr shouldn't have to fail #16485

Description

@SiegeLord

These functions are just so simple that they could easily be adapted not to fail. These API entires are not very beautiful right now, so the additional syntactic overhead of dealing with the result shouldn't be a big deal.

Possible API:

fn new(buf: *const i8, owns_buffer: bool) -> Result<CString, ()>
fn to_c_str(&self) -> Result<CString, ()>
fn with_c_str<T>(&self, f: |*const i8| -> T) -> Result<T, ()>

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions