We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
CompactStringExt
Hello.
I have been converting my discord bot to use CompactString throughout, mostly because I have nothing better to do tbh.
CompactString
There is this snippet of code :
minion_types .iter() .map(|t| t.in_locale(self.1)) // `in_locale` returns `impl Display` .join("/") // <-- from itertools .to_compact_string()
I tried playing with it in different ways to avoid the String creation in the middle by join, but join_compact is not apparently implemented for Map.
String
join
join_compact
Map
For example when I change it to this
minion_types .iter() .map(|t| t.in_locale(self.1).to_compact_string()) // not sure what to do here. .join_compact("/")
I get this extra verbose error
error[E0599]: the method `join_compact` exists for struct `Map<Iter<'_, MinionType>, {[email protected]:161:10}>`, but its trait bounds were not satisfied --> mimiron/src/bg.rs:162:6 | 159 | / minion_types 160 | | .iter() 161 | | .map(|t| t.in_locale(self.1).to_compact_string()) 162 | | .join_compact("/") | | -^^^^^^^^^^^^ method cannot be called on `Map<Iter<'_, MinionType>, {[email protected]:161:10}>` due to unsatisfied trait bounds | |_____| | | ::: /Users/abdulrahmansibahi/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/iter/adapters/map.rs:61:1 | 61 | pub struct Map<I, F> { | -------------------- doesn't satisfy `_: CompactStringExt` | = note: the following trait bounds were not satisfied: `<&'a std::iter::Map<std::collections::hash_set::Iter<'_, card_details::MinionType>, {closure@mimiron/src/bg.rs:161:10: 161:13}> as std::iter::IntoIterator>::Item = &'a _` which is required by `std::iter::Map<std::collections::hash_set::Iter<'_, card_details::MinionType>, {closure@mimiron/src/bg.rs:161:10: 161:13}>: compact_str::CompactStringExt` `&'a std::iter::Map<std::collections::hash_set::Iter<'_, card_details::MinionType>, {closure@mimiron/src/bg.rs:161:10: 161:13}>: std::iter::IntoIterator` which is required by `std::iter::Map<std::collections::hash_set::Iter<'_, card_details::MinionType>, {closure@mimiron/src/bg.rs:161:10: 161:13}>: compact_str::CompactStringExt`
I do not if I am missing something obvious or if this is a missing implementation from the library.
The text was updated successfully, but these errors were encountered:
concat_compact
Thanks for the bug report @asibahi! This is indeed an issue in the library, I just put up #418 to fix this and will release it with a v0.9
v0.9
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Hello.
I have been converting my discord bot to use
CompactString
throughout, mostly because I have nothing better to do tbh.There is this snippet of code :
I tried playing with it in different ways to avoid the
String
creation in the middle byjoin
, butjoin_compact
is not apparently implemented forMap
.For example when I change it to this
I get this extra verbose error
I do not if I am missing something obvious or if this is a missing implementation from the library.
The text was updated successfully, but these errors were encountered: