update examples
This commit is contained in:
1 parent
40b15f834b
commit
6ee4f7df4f
1 file changed
+7
-6
@@ -56,17 +56,17 @@ pub(crate) fn union_ordered_iter<'a>(
|
|||||||
/// impl ChildDepState for Layout {
|
/// impl ChildDepState for Layout {
|
||||||
/// type Ctx = ();
|
/// type Ctx = ();
|
||||||
/// // The layout depends on the layout of the children.
|
/// // The layout depends on the layout of the children.
|
||||||
/// type DepState = Layout;
|
/// type DepState = (Layout,);
|
||||||
/// fn reduce<'a>(
|
/// fn reduce<'a>(
|
||||||
/// &mut self,
|
/// &mut self,
|
||||||
/// _node: NodeView,
|
/// _node: NodeView,
|
||||||
/// children: impl Iterator<Item = &'a Self::DepState>,
|
/// children: impl Iterator<Item = (&'a Self,)>,
|
||||||
/// _ctx: &Self::Ctx,
|
/// _ctx: &Self::Ctx,
|
||||||
/// ) -> bool
|
/// ) -> bool
|
||||||
/// where
|
/// where
|
||||||
/// Self::DepState: 'a{
|
/// Self::DepState: 'a{
|
||||||
/// /// Children are layed out form left to right. The width of the parent is the sum of the widths and the max of the heights.
|
/// /// Children are layed out form left to right. The width of the parent is the sum of the widths and the max of the heights.
|
||||||
/// let new = children.copied().reduce(|c1, c2| Layout{
|
/// let new = children.map(|(&c,)|c).reduce(|c1, c2| Layout{
|
||||||
/// width: c1.width + c2.width,
|
/// width: c1.width + c2.width,
|
||||||
/// height: c1.height.max(c2.height)
|
/// height: c1.height.max(c2.height)
|
||||||
/// }).unwrap_or_default();
|
/// }).unwrap_or_default();
|
||||||
@@ -108,7 +108,7 @@ pub trait ChildDepState {
|
|||||||
/// impl ParentDepState for FontSize {
|
/// impl ParentDepState for FontSize {
|
||||||
/// type Ctx = ();
|
/// type Ctx = ();
|
||||||
/// // The font size depends on the font size of the parent element.
|
/// // The font size depends on the font size of the parent element.
|
||||||
/// type DepState = Self;
|
/// type DepState = (Self,);
|
||||||
/// const NODE_MASK: NodeMask =
|
/// const NODE_MASK: NodeMask =
|
||||||
/// NodeMask::new_with_attrs(AttributeMask::Static(&[
|
/// NodeMask::new_with_attrs(AttributeMask::Static(&[
|
||||||
/// "font-size"
|
/// "font-size"
|
||||||
@@ -116,12 +116,12 @@ pub trait ChildDepState {
|
|||||||
/// fn reduce<'a>(
|
/// fn reduce<'a>(
|
||||||
/// &mut self,
|
/// &mut self,
|
||||||
/// node: NodeView,
|
/// node: NodeView,
|
||||||
/// parent: Option<&'a Self::DepState>,
|
/// parent: Option<(&'a Self,)>,
|
||||||
/// ctx: &Self::Ctx,
|
/// ctx: &Self::Ctx,
|
||||||
/// ) -> bool{
|
/// ) -> bool{
|
||||||
/// let old = *self;
|
/// let old = *self;
|
||||||
/// // If the font size was set on the parent, it is passed down to the current element
|
/// // If the font size was set on the parent, it is passed down to the current element
|
||||||
/// if let Some(parent) = parent {
|
/// if let Some((parent,)) = parent {
|
||||||
/// *self = *parent;
|
/// *self = *parent;
|
||||||
/// }
|
/// }
|
||||||
/// // If the current node overrides the font size, use that size insead.
|
/// // If the current node overrides the font size, use that size insead.
|
||||||
@@ -168,6 +168,7 @@ pub trait ParentDepState {
|
|||||||
///
|
///
|
||||||
/// impl NodeDepState for TabIndex {
|
/// impl NodeDepState for TabIndex {
|
||||||
/// type Ctx = ();
|
/// type Ctx = ();
|
||||||
|
/// type DepState = ();
|
||||||
/// const NODE_MASK: NodeMask =
|
/// const NODE_MASK: NodeMask =
|
||||||
/// NodeMask::new_with_attrs(AttributeMask::Static(&[
|
/// NodeMask::new_with_attrs(AttributeMask::Static(&[
|
||||||
/// "tabindex"
|
/// "tabindex"
|
||||||
|
|||||||
Reference in new issue
Block a user