Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using references in the public API #820

Open
OmarTawfik opened this issue Feb 15, 2024 · 1 comment
Open

using references in the public API #820

OmarTawfik opened this issue Feb 15, 2024 · 1 comment
Assignees

Comments

@OmarTawfik
Copy link
Collaborator

OmarTawfik commented Feb 15, 2024

Incoming

Can we accept a reference to the source string in Language::parse() instead of owning it? using shared memory?
Is it worth it to avoid the copies in case of large strings?

Outgoing

Many API calls currently involve cloning and returning an Rc<T> needlessly, rather than returning &T. We should review and convert them where needed.

@OmarTawfik OmarTawfik changed the title returning references from public API using references in the public API Feb 15, 2024
@AntonyBlakey
Copy link
Contributor

Many API calls currently involve cloning and returning an Rc<T> needlessly, rather than returning &T. We should review and convert them where needed.

Not sure about that. We should maybe return &Rc<T>, to enable sharing, which you cannot do with a raw reference.

@OmarTawfik OmarTawfik self-assigned this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ⏳ Todo
Development

No branches or pull requests

2 participants