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

Swap Command and related structs to avoid String allocs #318

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

GnomedDev
Copy link
Member

This avoids allocating a bunch of Strings and Vecs when they can just be literals. This significantly simplifies command construction functions towards the goal of making them static, or close to at least.

This does not impact modifying these values at runtime as Cow<'static, str> can store String as well as &'static str.

Copy link
Member

@jamesbt365 jamesbt365 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it works at runtime it LGTM

@GnomedDev GnomedDev merged commit 6d2ae48 into serenity-rs:next Nov 13, 2024
12 checks passed
@GnomedDev GnomedDev deleted the cow-command branch November 13, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants