Skip to content

Commit

Permalink
storage: expand docs for trait with an example of where it's used.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Jun 29, 2024
1 parent 1a08c7a commit bd03035
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ pub(crate) trait SealedStorage {
/// - [`OwnedStorage`]: stores the data in an array `[T; N]` whose size is known at compile time.
/// - [`ViewStorage`]: stores the data in an unsized `[T]`.
///
/// This allows containers to be generic over either sized or unsized storage.
/// This allows containers to be generic over either sized or unsized storage. For example,
/// the [`vec`](crate::vec) module contains a [`VecInner`](crate::vec::VecInner) struct
/// that's generic on [`Storage`], and two type aliases for convenience:
///
/// - [`Vec<T, N>`](crate::vec::Vec) = `VecInner<T, OwnedStorage<N>>`
/// - [`VecView<T>`](crate::vec::VecView) = `VecInner<T, ViewStorage>`
///
/// `Vec` can be unsized into `VecView`, either by unsizing coercions such as `&mut Vec -> &mut VecView` or
/// `Box<Vec> -> Box<VecView>`, or explicitly with [`.as_view()`](crate::vec::Vec::as_view) or [`.as_mut_view()`](crate::vec::Vec::as_mut_view).
///
/// This trait is sealed, so you cannot implement it for your own types. You can only use
/// the implementations provided by this crate.
Expand Down

0 comments on commit bd03035

Please sign in to comment.