Skip to content

API for passing already nul-terminated strings to avoid allocation #54

Open

Description

@SSheldon

Currently, in the runtime and declare modules, the API takes &str for ease of use. However, this requires copying the string into a buffer and adding a nul terminator byte. It might be desirable for some cases to have a way to pass in strings which are already known to be nul-terminated so that this allocation can be avoided.

Activity

  1. SSheldon commented on Apr 30, 2017

    @SSheldon
    OwnerAuthor

    Exploring some options here and created the nul crate.

    Currently conflicted on whether that's the best solution. I'm realizing that really, the only strings that need to be provided are names (of classes, ivars, methods, etc). We could make an even nicer macro for generating those because they're idents. Maybe something like name!(NSObject) instead of ntstr!("NSObject"). At that point, is a separate crate even worth it? Or should we just have an objc::Name struct for encapsulating this.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions