deref_owned
This crate provides a smart pointer Owned, which points to a value that can
be borrowed from an owned inner value. It's similar to
Cow, except that it's
always owning a value.
Moreover, a trait GenericCow is provided, which allows conversion from
certain pointers into an owned value though an .into_owned() method. The
trait GenericCow is implemented for:
&'a B where B: ToOwnedCow<'a, B> where B: ToOwnedOwned<'a, B, O> where O: Borrow<B>
Here
B: ?Sizedis the borrowed type (and also the type of the pointer target) andO: Borrow<B>is an owned type.
Changelog
- 2022-07-01: Version 0.6.1
- Corrected
Owned::borrowedto bePhantomData<for<'a> fn(&'a O) -> &'a B>instead of usingPhantomData<*const B>, which broke correct autotrait behavior
- Corrected
- 2022-07-01: Version 0.6.0
- Removed lifetime argument for
Owned - Fixed changelog for version 0.5.0
- Removed lifetime argument for
- 2022-07-01: Version 0.5.0
- A lifetime and type argument for the borrowed type has been added to
Owned, which now contains aPhantomDataof a reference to the borrowed type. This makesOwnedRefsuperfluous, which has been removed. IntoOwnedhas been renamed toGenericCow.- Removed
AsMut,BorrowMutandDerefMutimplementations forOwned
- A lifetime and type argument for the borrowed type has been added to
- 2022-06-30: Version 0.4.0
- Removed implementations of
IntoOwnedforBox<T>,Vec<T>, andString - New wrapper type
OwnedRef<T>
- Removed implementations of
- 2022-06-28: Version 0.3.0
- Added implementations of
IntoOwnedforBox<T>(where T: ?Sized),Vec<T>, andString, withIntoOwned::Ownedbeing set toSelf(replaces previous implementation forBox<T>)
- Added implementations of
- 2022-06-27: Version 0.2.0
- Some more trait implementations (
AsRef,AsMut,Borrow,BorrowMut, andDisplay) have been added forOwned(andDebug::fmt's output is transparent now) Derefis now a supertrait ofIntoOwnedandIntoOwned::Ownedmust implementBorrow<<Self as Deref>::Target>
- Some more trait implementations (
- 2022-06-26: Version 0.1.0
- Initial release