12 releases (7 breaking)

0.10.2 Jul 12, 2022
0.9.0 Jul 4, 2022

#2066 in Rust patterns


Used in mmtkvdb

MIT/Apache

15KB
232 lines

deref_owned

Generalization of std::borrow::Cow, which can be used to reduce runtime overhead in certain scenarios.

Changelog

  • 2022-07-12: Version 0.10.2
    • Improved documentation
  • 2022-07-10: Version 0.10.1
    • Improved documentation
    • Added #[repr(transparent)] to Owned wrapper
  • 2022-07-10: Version 0.10.0
    • The borrowed (i.e. pointed-to) type is now used as a type argument for Owned. This allows specifying the borrowed type as an associated type of the GenericCow trait, which aids type inference.
    • Implementation of From for Owned had to be removed.
  • 2022-07-04: Version 0.8.2
    • Added implementation of From<T> for Owned<T>
    • Added missing version numbers 0.8.0 and 0.8.1 in changelog
    • Added some tests
  • 2022-07-04: Version 0.9.0 (yanked)
    • Added implementation of From<T> for Owned<T>
    • Removed implementation of AsRef<U> for Owned<T> and implement AsRef<T> only (this is to allow going from Owned<T> to T where T: !AsRef<T>) (Yanked because .borrow() should be used in that case.)
    • Added missing version numbers 0.8.0 and 0.8.1 in changelog
  • 2022-07-04: Version 0.8.1
    • Added example to crate-level documentation comment
  • 2022-07-02: Version 0.8.0
    • Struct Owned is now a simple wrapper with one type argument (of its inner value).
    • Owned::new has been removed.
    • The associated type GenericCow<B>::Owned has been removed in favor of using <B as ToOwned>::Owned.
    • Modified documentation to avoid the terminology "smart pointer"
    • Modified tests
  • 2022-07-01: Version 0.7.0
    • Removed Deref as supertrait of GenericCow and added type argument to GenericCow instead
  • 2022-07-01: Version 0.6.1
    • Corrected Owned::borrowed to be PhantomData<for<'a> fn(&'a O) -> &'a B> instead of using PhantomData<*const B>, which broke correct autotrait behavior
  • 2022-07-01: Version 0.6.0
    • Removed lifetime argument for Owned
    • Fixed changelog for version 0.5.0
  • 2022-07-01: Version 0.5.0
    • A lifetime and type argument for the borrowed type has been added to Owned, which now contains a PhantomData of a reference to the borrowed type. This makes OwnedRef superfluous, which has been removed.
    • IntoOwned has been renamed to GenericCow.
    • Removed AsMut, BorrowMut and DerefMut implementations for Owned
  • 2022-06-30: Version 0.4.0
    • Removed implementations of IntoOwned for Box<T>, Vec<T>, and String
    • New wrapper type OwnedRef<T>
  • 2022-06-28: Version 0.3.0
    • Added implementations of IntoOwned for Box<T> (where T: ?Sized), Vec<T>, and String, with IntoOwned::Owned being set to Self (replaces previous implementation for Box<T>)
  • 2022-06-27: Version 0.2.0
    • Some more trait implementations (AsRef, AsMut, Borrow, BorrowMut, and Display) have been added for Owned (and Debug::fmt's output is transparent now)
    • Deref is now a supertrait of IntoOwned and IntoOwned::Owned must implement Borrow<<Self as Deref>::Target>
  • 2022-06-26: Version 0.1.0
    • Initial release

No runtime deps