Skip to content

Commit

Permalink
Doc: visibility for Visitor / Visitable*.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Jan 15, 2024
1 parent b81bd56 commit c4a460d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/kas-core/src/layout/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use crate::{dir::Directional, dir::Directions, Layout};
///
/// Unlike when implementing a widget, all methods of this trait must be
/// implemented directly.
#[cfg_attr(not(feature = "internal_doc"), doc(hidden))]
#[cfg_attr(doc_cfg, doc(cfg(internal_doc)))]
#[crate::autoimpl(for<T: trait + ?Sized> &'_ mut T, Box<T>)]
pub trait Visitable {
/// Get size rules for the given axis
Expand Down Expand Up @@ -52,6 +54,8 @@ pub trait Visitable {
///
/// This is templated over `cell_info: C` where `C = ()` for lists or
/// `C = GridChildInfo` for grids.
#[cfg_attr(not(feature = "internal_doc"), doc(hidden))]
#[cfg_attr(doc_cfg, doc(cfg(internal_doc)))]
pub trait VisitableList<C> {
/// List length
fn len(&self) -> usize;
Expand All @@ -78,15 +82,14 @@ impl<C> VisitableList<C> for () {

/// A layout visitor
///
/// This constitutes a "visitor" which iterates over each child widget. Layout
/// algorithm details are implemented over this visitor.
/// Objects are generated by [`layout`] syntax. These all have limited lifetime.
///
/// This is an internal API and may be subject to unexpected breaking changes.
#[cfg_attr(not(feature = "internal_doc"), doc(hidden))]
#[cfg_attr(doc_cfg, doc(cfg(internal_doc)))]
/// [`layout`]: crate::widget#layout-1
pub struct Visitor<V: Visitable>(V);

/// These methods would be free functions, but `Visitable` is a useful namespace
#[cfg_attr(not(feature = "internal_doc"), doc(hidden))]
#[cfg_attr(doc_cfg, doc(cfg(internal_doc)))]
impl<'a> Visitor<Box<dyn Visitable + 'a>> {
/// Construct a single-item layout
pub fn single(widget: &'a mut dyn Layout) -> Visitor<impl Visitable + 'a> {
Expand Down

0 comments on commit c4a460d

Please sign in to comment.