Put IntoContextElement everywhere. It compiles again.

This commit is contained in:
Tom Alexander
2020-05-30 17:50:27 -04:00
parent 975ab278ef
commit 917da5a073
7 changed files with 112 additions and 88 deletions

View File

@@ -1,18 +1,18 @@
use crate::renderer::context_element::ContextElement;
use crate::renderer::context_element::Walkable;
use crate::renderer::context_element::IntoContextElement;
use crate::renderer::WalkError;
use std::borrow::Borrow;
enum WalkResult<'a> {
NoWalk,
PartialWalk,
FullyWalked(&'a dyn ContextElement),
FullyWalked(&'a dyn IntoContextElement),
}
fn walk_path_from_single_level<'a, P, C>(context: &'a C, path: &[P]) -> WalkResult<'a>
where
P: Borrow<str>,
C: Borrow<dyn ContextElement + 'a>,
C: Borrow<dyn IntoContextElement + 'a>,
{
if path.is_empty() {
return WalkResult::FullyWalked(context.borrow());
@@ -37,7 +37,7 @@ where
pub fn get_first_non_pseudo_element<'a, B>(breadcrumbs: &'a Vec<B>) -> Option<&B>
where
B: Borrow<dyn ContextElement + 'a>,
B: Borrow<dyn IntoContextElement + 'a>,
{
breadcrumbs
.iter()
@@ -49,9 +49,9 @@ where
pub fn walk_path<'a, B, P>(
breadcrumbs: &'a Vec<B>,
path: &Vec<P>,
) -> Result<&'a dyn ContextElement, WalkError>
) -> Result<&'a dyn IntoContextElement, WalkError>
where
B: Borrow<dyn ContextElement + 'a>,
B: Borrow<dyn IntoContextElement + 'a>,
P: Borrow<str>,
{
if breadcrumbs.is_empty() {