fragment.rs 557 B

12345678910111213141516
  1. use crate::{ElementId, VNode};
  2. use std::cell::Cell;
  3. /// A list of VNodes with no single root.
  4. pub struct VFragment<'src> {
  5. /// The key of the fragment to be used during keyed diffing.
  6. pub key: Option<&'src str>,
  7. /// The [`ElementId`] of the placeholder if it exists
  8. pub placeholder: Cell<Option<ElementId>>,
  9. /// Fragments can never have zero children. Enforced by NodeFactory.
  10. ///
  11. /// You *can* make a fragment with no children, but it's not a valid fragment and your VDom will panic.
  12. pub children: &'src [VNode<'src>],
  13. }