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

std and alloc improvements #1309

Merged
merged 1 commit into from
Nov 11, 2021
Merged

std and alloc improvements #1309

merged 1 commit into from
Nov 11, 2021

Conversation

kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Nov 11, 2021

  • Compiling with no_std no longer removes all of the string conversion operations.
  • The alloc feature was added to enable implicit parameter allocations for strings.

@kennykerr kennykerr merged commit 372556f into master Nov 11, 2021
@kennykerr kennykerr deleted the str branch November 11, 2021 18:53
@kennykerr kennykerr mentioned this pull request Nov 12, 2021
impl ::core::convert::From<&str> for BSTR {
fn from(value: &str) -> Self {
let value: ::std::vec::Vec<u16> = value.encode_utf16().collect();
let value: ::windows::runtime::alloc::vec::Vec<u16> = value.encode_utf16().collect();
Copy link
Contributor

Choose a reason for hiding this comment

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

@kennykerr Shouldn't this and other allocations for BSTR be wrapped in the alloc feature just like some of the other functions?

In other words, perhaps you should hide:

#[doc(hidden)]
pub extern crate alloc;

Behind the alloc feature too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The alloc feature is to avoid implicit allocations like IntoParam. From/Into should still work regardless as they are explicit.

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