Skip to content

add some more From impls + IntoCow#24

Merged
bors[bot] merged 4 commits into
mainfrom
convenience
Oct 29, 2022
Merged

add some more From impls + IntoCow#24
bors[bot] merged 4 commits into
mainfrom
convenience

Conversation

@Emilgardis

Copy link
Copy Markdown
Member

No description provided.

@Emilgardis

Copy link
Copy Markdown
Member Author

related to twitch-rs/twitch_api#280

@Emilgardis Emilgardis added the release marks a pr that does a release label Oct 28, 2022
@Emilgardis Emilgardis force-pushed the convenience branch 2 times, most recently from 8b78800 to c25f8f5 Compare October 28, 2022 18:02
@Emilgardis Emilgardis force-pushed the convenience branch 2 times, most recently from 0085dda to 7fbdaad Compare October 28, 2022 22:20
Comment thread src/lib.rs
Comment on lines +168 to +195
pub fn broadcaster_id<'a>(broadcaster_id: impl IntoCow<'a, UserIdRef> + 'a) -> bool {
struct K<'a> {
id: std::borrow::Cow<'a, UserIdRef>,
}
let k = K {
id: broadcaster_id.to_cow(),
};
matches!(k.id, std::borrow::Cow::Borrowed(_))
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Nerixyz I think this solves the issue described in twitch-rs/twitch_api#280 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes this should solve it 👍

@Emilgardis Emilgardis changed the title add some more From impls add some more From impls + IntoCow Oct 28, 2022
@Emilgardis Emilgardis force-pushed the convenience branch 2 times, most recently from fb0b663 to 0cc5242 Compare October 28, 2022 22:33
@Emilgardis

Copy link
Copy Markdown
Member Author

bors r+

bors Bot added a commit that referenced this pull request Oct 29, 2022
24: add some more `From` impls + `IntoCow` r=Emilgardis a=Emilgardis



Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
@Emilgardis

Copy link
Copy Markdown
Member Author

bors r-

@bors

bors Bot commented Oct 29, 2022

Copy link
Copy Markdown
Contributor

Canceled.

@Emilgardis

Copy link
Copy Markdown
Member Author

bors r+

bors Bot added a commit that referenced this pull request Oct 29, 2022
24: add some more `From` impls + `IntoCow` r=Emilgardis a=Emilgardis



Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
@bors

bors Bot commented Oct 29, 2022

Copy link
Copy Markdown
Contributor

Build failed:

@Emilgardis

Copy link
Copy Markdown
Member Author

bors r+

@bors

bors Bot commented Oct 29, 2022

Copy link
Copy Markdown
Contributor

Build succeeded:

  • audit
  • CI

@bors bors Bot merged commit 547c624 into main Oct 29, 2022
@bors bors Bot deleted the convenience branch October 29, 2022 12:53
@spikespaz

Copy link
Copy Markdown

Isn't this an antipattern? The implementation isn't complete and is causing build errors. Can't we expect the API user to wrap the types in Cow themselves, instead of making your source code harder to read.

@Emilgardis

Copy link
Copy Markdown
Member Author

@spikespaz can you please elaborate in a new issue. There shouldn't be any problems with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release marks a pr that does a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants