chore: rollback to option instead of anyhow

This commit is contained in:
Jonathan Kelley committed 2022-12-19 18:06:13 -08:00
1 parent d6804884ab
commit d3be971f4e
21 files changed
+45 -56

No files matched your search

+3 -13
View File
@@ -58,7 +58,7 @@ pub struct VNode<'a> {
impl<'a> VNode<'a> {
/// Create a template with no nodes that will be skipped over during diffing
pub fn empty() -> Element<'a> {
Ok(VNode {
Some(VNode {
key: None,
parent: None,
root_ids: &[],
@@ -466,16 +466,6 @@ impl<'a> IntoDynNode<'a> for DynamicNode<'a> {
}
}
// An element that's an error is currently lost into the ether
impl<'a> IntoDynNode<'a> for Element<'a> {
fn into_vnode(self, _cx: &'a ScopeState) -> DynamicNode<'a> {
match self {
Ok(val) => val.into_vnode(_cx),
_ => DynamicNode::default(),
}
}
}
impl<'a, T: IntoDynNode<'a>> IntoDynNode<'a> for Option<T> {
fn into_vnode(self, _cx: &'a ScopeState) -> DynamicNode<'a> {
match self {
@@ -488,7 +478,7 @@ impl<'a, T: IntoDynNode<'a>> IntoDynNode<'a> for Option<T> {
impl<'a> IntoDynNode<'a> for &Element<'a> {
fn into_vnode(self, _cx: &'a ScopeState) -> DynamicNode<'a> {
match self.as_ref() {
Ok(val) => val.clone().into_vnode(_cx),
Some(val) => val.clone().into_vnode(_cx),
_ => DynamicNode::default(),
}
}
@@ -542,7 +532,7 @@ impl<'a> IntoTemplate<'a> for VNode<'a> {
impl<'a> IntoTemplate<'a> for Element<'a> {
fn into_template(self, _cx: &'a ScopeState) -> VNode<'a> {
match self {
Ok(val) => val.into_template(_cx),
Some(val) => val.into_template(_cx),
_ => VNode::empty().unwrap(),
}
}