Skip to content

Commit

Permalink
Merge pull request #4 from brunoczim/try_methods
Browse files Browse the repository at this point in the history
introduce try methods
  • Loading branch information
brunoczim authored Sep 8, 2023
2 parents ac1dd56 + 929e069 commit 3971f85
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 63 deletions.
16 changes: 8 additions & 8 deletions examples/simple_pedia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ fn index() -> impl FullRender<Kind = PageComponent> + Send + Sync + 'static {
children: harray![
Section {
title: "Random Section",
id: Some(Id::new("random").unwrap()),
id: Some(Id::new("random")),
body: Paragraph("This is a random paragraph."),
children: harray![
Section {
title: "Randomly First",
id: Some(Id::new("random-first").unwrap()),
id: Some(Id::new("random-first")),
body: Paragraph(
"This the first (really?) random paragraph."
),
children: harray![],
},
Section {
title: "Randomly Second",
id: Some(Id::new("random-second").unwrap()),
id: Some(Id::new("random-second")),
body: Paragraph(
"This the second (really??) random paragraph."
),
Expand All @@ -73,7 +73,7 @@ fn index() -> impl FullRender<Kind = PageComponent> + Send + Sync + 'static {
},
Section {
title: "Weird Title",
id: Some(Id::new("weird").unwrap()),
id: Some(Id::new("weird")),
body: Paragraph("Weird paragraph as an example"),
children: harray![],
}
Expand Down Expand Up @@ -124,19 +124,19 @@ fn simple_pedia_site() -> Site<DynFullComponent<'static, PageComponent>> {
site.root
.insert_index(InternalPath::root(), Entry::Page(index().into_dyn()));
site.root.insert_index(
InternalPath::parse("foo").unwrap(),
InternalPath::parse("foo"),
Entry::Page(foo_page().into_dyn()),
);
site.root.insert_index(
InternalPath::parse("bar").unwrap(),
InternalPath::parse("bar"),
Entry::Page(bar_page().into_dyn()),
);
site.root.insert_index(
InternalPath::parse("bar/baz").unwrap(),
InternalPath::parse("bar/baz"),
Entry::Page(baz_page().into_dyn()),
);
site.root.insert_path(
&InternalPath::parse("styles/main.css").unwrap(),
&InternalPath::parse("styles/main.css"),
Entry::Resource,
);
site
Expand Down
2 changes: 1 addition & 1 deletion src/component/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ mod test {
},
Section {
title: "Good",
id: Some(Id::new("good").unwrap()),
id: Some(Id::new("good")),
body: Paragraph("Afternoon!"),
children: harray![Section {
title: "By",
Expand Down
4 changes: 2 additions & 2 deletions src/component/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ mod test {
let rendered = RenderAsDisplay::new(
Section {
title: "Hello",
id: Some(Id::new("hello").unwrap()),
id: Some(Id::new("hello")),
body: Paragraph("World!"),
children: harray![],
},
Expand Down Expand Up @@ -389,7 +389,7 @@ mod test {
},
Section {
title: "Good",
id: Some(Id::new("good").unwrap()),
id: Some(Id::new("good")),
body: Paragraph("Afternoon!"),
children: harray![Section {
title: "By",
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,20 @@
//! children: harray![
//! Section {
//! title: "Random Section",
//! id: Some(Id::new("random").unwrap()),
//! id: Some(Id::new("random")),
//! body: Paragraph("This is a random paragraph."),
//! children: harray![
//! Section {
//! title: "Randomly First",
//! id: Some(Id::new("random-first").unwrap()),
//! id: Some(Id::new("random-first")),
//! body: Paragraph(
//! "This the first (really?) random paragraph."
//! ),
//! children: harray![],
//! },
//! Section {
//! title: "Randomly Second",
//! id: Some(Id::new("random-second").unwrap()),
//! id: Some(Id::new("random-second")),
//! body: Paragraph(
//! "This the second (really??) random paragraph."
//! ),
Expand All @@ -121,7 +121,7 @@
//! },
//! Section {
//! title: "Weird Title",
//! id: Some(Id::new("weird").unwrap()),
//! id: Some(Id::new("weird")),
//! body: Paragraph("Weird paragraph as an example"),
//! children: harray![],
//! }
Expand Down Expand Up @@ -172,19 +172,19 @@
//! site.root
//! .insert_index(InternalPath::root(), Entry::Page(index().into_dyn()));
//! site.root.insert_index(
//! InternalPath::parse("foo").unwrap(),
//! InternalPath::parse("foo"),
//! Entry::Page(foo_page().into_dyn()),
//! );
//! site.root.insert_index(
//! InternalPath::parse("bar").unwrap(),
//! InternalPath::parse("bar"),
//! Entry::Page(bar_page().into_dyn()),
//! );
//! site.root.insert_index(
//! InternalPath::parse("bar/baz").unwrap(),
//! InternalPath::parse("bar/baz"),
//! Entry::Page(baz_page().into_dyn()),
//! );
//! site.root.insert_path(
//! &InternalPath::parse("styles/main.css").unwrap(),
//! &InternalPath::parse("styles/main.css"),
//! Entry::Resource,
//! );
//! site
Expand Down
Loading

0 comments on commit 3971f85

Please sign in to comment.