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

[stdlib] Addition of a new constructor and reserve method to the String struct #3751

Closed
wants to merge 7 commits into from

Conversation

thatstoasty
Copy link
Contributor

@thatstoasty thatstoasty commented Nov 6, 2024

Adds a public API for users to allocate capacity through String, instead of having to reach into the private internal ._buffer attribute.

Satisfies: #3738

NOTE: Waiting for #3735 to go through so the pixi.toml changes make it through.

…agic run` to pre-commit configuration.

squash code a bit by using write

add tests

Cleanup with formatting and sign

add missing newline

Signed-off-by: Mikhail Tavarez <[email protected]>

updated changelog
…agic run` to pre-commit configuration.

squash code a bit by using write

add tests

Cleanup with formatting and sign

add missing newline

Signed-off-by: Mikhail Tavarez <[email protected]>

updated changelog

updated changelog

Add unsetenv and use a context manager to unset test variables.

Add renamed test_env.mojo

Fix unsetenv result in EnvVar context manager.

Signed-off-by: Mikhail Tavarez <[email protected]>

use constrained for unsetenv

use immutable stringslice
Comment on lines 2311 to 2316
If the current capacity is greater or equal, this is a no-op.
Otherwise, the storage is reallocated and the date is moved.

Args:
new_capacity: The new capacity.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
If the current capacity is greater or equal, this is a no-op.
Otherwise, the storage is reallocated and the date is moved.
Args:
new_capacity: The new capacity.
"""
Args:
new_capacity: The new capacity.
Notes:
If the current capacity is greater or equal, this is a no-op.
Otherwise, the storage is reallocated and the data is moved.
"""

@thatstoasty
Copy link
Contributor Author

Commits are borked here, opening a new PR

@thatstoasty thatstoasty closed this Nov 7, 2024
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