pub struct Group { /* private fields */ }Expand description
A named group of nested questionnaire items.
The id is the stable machine identity rendered as the line-terminal
tag (<id:command.inputs>); the prompt is human wording and may be
edited freely. Every child’s ID must extend the group’s ID with a . segment
(command.inputs → command.inputs.name), which keeps submitted
occurrence paths derivable from definition IDs.
A plain group (Group::new) renders and is answered exactly once — it
structures related questions under one heading. A repeatable group
(Group::repeatable) is answered once per submitted occurrence:
rendering emits exactly the declared minimum number of blank blocks, and
a person adds items by copying a complete block (its heading line and its
questions). The number of submitted items is inferred from occurrences of
the stable group header, never from display numbers or wording.
Implementations§
Source§impl Group
impl Group
Sourcepub fn new(
id: impl Into<String>,
prompt: impl Into<String>,
children: impl IntoIterator<Item = impl Into<Item>>,
) -> Self
pub fn new( id: impl Into<String>, prompt: impl Into<String>, children: impl IntoIterator<Item = impl Into<Item>>, ) -> Self
Create a non-repeatable group with a stable id, human prompt
wording, and nested children.
The id, the child-ID prefix rule, and all nested declarations are
validated when the group is passed to Questionnaire::new, not
here.
Sourcepub fn repeatable(self, min: usize) -> Self
pub fn repeatable(self, min: usize) -> Self
Make this group repeatable with at least min occurrences
(min >= 1; rendering emits exactly min blank blocks).
Repeat bounds are semantic: they change the fingerprint.
Sourcepub fn max_occurrences(self, max: usize) -> Self
pub fn max_occurrences(self, max: usize) -> Self
Bound a repeatable group to at most max occurrences.
Only meaningful after repeatable;
Questionnaire::new rejects a maximum on a non-repeatable group or
a maximum below the minimum. Semantic: changes the fingerprint.
Trait Implementations§
impl Eq for Group
impl StructuralPartialEq for Group
Auto Trait Implementations§
impl !RefUnwindSafe for Group
impl !UnwindSafe for Group
impl Freeze for Group
impl Send for Group
impl Sync for Group
impl Unpin for Group
impl UnsafeUnpin for Group
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more