Name Description Size
cartable_ptr.rs Types for optional pointers with niche optimization. The main type is [`CartableOptionPointer`], which is like `Option<Rc>` but with a niche so that the resulting `Yoke` has a niche. The following four types can be stored in the `CartableOptionPointer`: 1. `&T` 2. `Box<T>` 3. `Rc<T>` 4. `Arc<T>` These four types implement the sealed unsafe trait [`CartablePointerLike`]. In addition, all except `Box<T>` impl [`CloneableCartablePointerLike`], which allows [`CartableOptionPointer`] to implement `Clone`. 13375
either.rs Types to enable polymorphic carts. 2542
erased.rs This module contains helper types for erasing Cart types. See the docs of [`Yoke::erase_rc_cart()`](crate::Yoke::erase_rc_cart) and [`Yoke::erase_box_cart()`](crate::Yoke::erase_box_cart) for more info. ✨ *Enabled with the `alloc` Cargo feature.* 1654
kinda_sorta_dangling.rs 4104
lib.rs This crate provides [`Yoke<Y, C>`][Yoke], which allows one to "yoke" (attach) a zero-copy deserialized object (say, a [`Cow<'a, str>`](alloc::borrow::Cow)) to the source it was deserialized from, (say, an [`Rc<[u8]>`](alloc::rc::Rc)), known in this crate as a "cart", producing a type that looks like `Yoke<Cow<'static, str>, Rc<[u8]>>` and can be moved around with impunity. Succinctly, this allows one to "erase" static lifetimes and turn them into dynamic ones, similarly to how `dyn` allows one to "erase" static types and turn them into dynamic ones. Most of the time the yokeable `Y` type will be some kind of zero-copy deserializable abstraction, potentially with an owned variant (like [`Cow`](alloc::borrow::Cow), [`ZeroVec`](https://docs.rs/zerovec), or an aggregate containing such types), and the cart `C` will be some smart pointer like [`Box<T>`](alloc::boxed::Box), [`Rc<T>`](alloc::rc::Rc), or [`Arc<T>`](std::sync::Arc), potentially wrapped in an [`Option<T>`](Option). The key behind this crate is [`Yoke::get()`], where calling [`.get()`][Yoke::get] on a type like `Yoke<Cow<'static, str>, _>` will get you a short-lived `&'a Cow<'a, str>`, restricted to the lifetime of the borrow used during [`.get()`](Yoke::get). This is entirely safe since the `Cow` borrows from the cart type `C`, which cannot be interfered with as long as the `Yoke` is borrowed by [`.get()`](Yoke::get). [`.get()`](Yoke::get) protects access by essentially reifying the erased lifetime to a safe local one when necessary. See the documentation of [`Yoke`] for more details. 2879
macro_impls.rs 3153
trait_hack.rs 9036
yoke.rs 56981
yokeable.rs 12420
zero_from.rs 1686