Add docs.

This commit is contained in:
Stephen Chung 2022-08-14 18:16:35 +08:00
parent 855ddd28a6
commit 5f2262214d
2 changed files with 5 additions and 0 deletions

View File

@ -362,6 +362,8 @@ pub enum Expr {
/// ///
/// Used to hold complex constants such as [`Array`][crate::Array] or [`Map`][crate::Map] for quick cloning. /// Used to hold complex constants such as [`Array`][crate::Array] or [`Map`][crate::Map] for quick cloning.
/// Primitive data types should use the appropriate variants to avoid an allocation. /// Primitive data types should use the appropriate variants to avoid an allocation.
///
/// The [`Dynamic`] value is boxed in order to avoid bloating the size of [`Expr`].
DynamicConstant(Box<Dynamic>, Position), DynamicConstant(Box<Dynamic>, Position),
/// Boolean constant. /// Boolean constant.
BoolConstant(bool, Position), BoolConstant(bool, Position),

View File

@ -186,6 +186,9 @@ pub enum Union {
TimeStamp(Box<Instant>, Tag, AccessMode), TimeStamp(Box<Instant>, Tag, AccessMode),
/// Any type as a trait object. /// Any type as a trait object.
///
/// An extra level of redirection is used in order to avoid bloating the size of [`Dynamic`]
/// because `Box<dyn Variant>` is a fat pointer.
Variant(Box<Box<dyn Variant>>, Tag, AccessMode), Variant(Box<Box<dyn Variant>>, Tag, AccessMode),
/// A _shared_ value of any type. /// A _shared_ value of any type.