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

Error with implicit Deref String in &str #51

Open
uselessgoddess opened this issue Jul 27, 2022 · 0 comments
Open

Error with implicit Deref String in &str #51

uselessgoddess opened this issue Jul 27, 2022 · 0 comments

Comments

@uselessgoddess
Copy link

If i use the following code with std::Cow - will be ok

let string = "hello".to_string();
let cow: Cow<str> = Cow::from(&string);

but beef::Cow tells me:

error[E0277]: the trait bound `String: beef::traits::internal::Beef` is not satisfied
  --> src\main.rs:6:35
   |
6  |     let cow: Cow<str> = Cow::from(&string);
   |                         --------- ^^^^^^^ the trait `beef::traits::internal::Beef` is not implemented for `String`
   |                         |
   |                         required by a bound introduced by this call
   |
   = help: the trait `beef::traits::internal::Beef` is implemented for `str`
note: required by a bound in `beef::generic::Cow`
  --> F:\Rust\beef\src\generic.rs:26:23
   |
26 | pub struct Cow<'a, T: Beef + ?Sized + 'a, U: Capacity> {
   |                       ^^^^ required by this bound in `beef::generic::Cow`

Maybe you need an explicit impl From<&str> for Cow in addition to From<&T>?
Or is it not important?

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

No branches or pull requests

1 participant