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

Improve Env::get, add Env::get_string_lossy #565

Merged
merged 1 commit into from
Apr 28, 2023
Merged

Conversation

Malax
Copy link
Member

@Malax Malax commented Apr 25, 2023

Changelog

Changed

  • Env::get now returns Option<&OsString> instead of Option<OsString>. This is more in line with expectations users have when dealing with a collection type. This is a breaking change, compile errors can be fixed by adding a Option::cloned call after Env::get to get the old behaviour. In some cases, cloning might not be necessary, slightly improving the code that uses Env::get. (#565)

Added

  • Env::get_string_lossy as a convenience method to work with environment variables directly. Getting a value out of an Env and treating its contents as unicode is a common case. Using this new method can simplify buildpack code. (#565)

Closes #74.

@Malax Malax force-pushed the malax/env-changes branch 3 times, most recently from 5c62ba6 to 1632840 Compare April 25, 2023 12:07
@Malax Malax marked this pull request as ready for review April 25, 2023 13:11
@Malax Malax requested a review from a team as a code owner April 25, 2023 13:11
@edmorley edmorley added the enhancement New feature or request label Apr 26, 2023
@Malax Malax merged commit c159e2e into main Apr 28, 2023
5 checks passed
@Malax Malax deleted the malax/env-changes branch April 28, 2023 08:20
colincasey added a commit that referenced this pull request Jun 12, 2023
* main:
  Update fastrand requirement from 1.8.0 to 2.0.0 (#573)
  Fix lint failures with Rust 1.70 (#574)
  Bump Swatinem/rust-cache from 2.3.0 to 2.4.0 (#572)
  Bump Swatinem/rust-cache from 2.2.1 to 2.3.0 (#571)
  Bump buildpacks/github-actions from 5.1.0 to 5.2.0 (#569)
  Prepare 0.12.0 release (#568)
  Support Buildpack API `0.9` (#567)
  Add Clone for Scope (#566)
  Improve Env::get, add Env::get_string_lossy (#565)
  Bump buildpacks/github-actions from 5.0.1 to 5.1.0 (#564)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return a borrowed not cloned object from Env::get
2 participants