| Crates.io | cow2 |
| lib.rs | cow2 |
| version | 0.2.6 |
| created_at | 2025-05-31 07:58:04.438697+00 |
| updated_at | 2025-06-01 02:10:02.36368+00 |
| description | Like Cow, but B is covariant |
| homepage | |
| repository | https://github.com/A4-Tacks/cow2-rs |
| max_upload_size | |
| id | 1696154 |
| size | 17,302 |
Like Cow<'_, B>, but B is covariant
Implemented similar to rust#96312
Since std::borrow::Cow uses associated type, it invariant,
see rust#115799 for details
Use std::borrow::Cow compile-fail case:
use std::borrow::Cow;
fn foo<'a>(_: Cow<'a, [Cow<'a, str>]>) { }
fn bar<'a>(x: Cow<'a, [Cow<'static, str>]>) {
foo(x);
}
Use cow2::Cow compile-passed case:
use cow2::Cow;
fn foo<'a>(_: Cow<'a, [Cow<'a, str>]>) { }
fn bar<'a>(x: Cow<'a, [Cow<'static, str>]>) {
foo(x);
}