Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ee96e26

Browse files
committed
feat: Add convenience methods for Group::with_title
1 parent 05ee34e commit ee96e26

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/snippet.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,16 @@ impl<'a> Title<'a> {
190190
self.id.get_or_insert(Id::default()).url = Some(url.into());
191191
self
192192
}
193+
194+
/// Append an [`Element`] that adds context to the [`Title`]
195+
pub fn element(self, section: impl Into<Element<'a>>) -> Group<'a> {
196+
Group::with_title(self).element(section)
197+
}
198+
199+
/// Append [`Element`]s that adds context to the [`Title`]
200+
pub fn elements(self, sections: impl IntoIterator<Item = impl Into<Element<'a>>>) -> Group<'a> {
201+
Group::with_title(self).elements(sections)
202+
}
193203
}
194204

195205
/// A text [`Element`] in a [`Group`]

0 commit comments

Comments
 (0)