Diffstat (limited to 'src/impls/core/str.rs')
| -rw-r--r-- | src/impls/core/str.rs | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/src/impls/core/str.rs b/src/impls/core/str.rs index a3fcc01..77ef5cc 100644 --- a/src/impls/core/str.rs +++ b/src/impls/core/str.rs @@ -15,10 +15,10 @@ use crate::{ use super::reference::BuilderRefValue; -pub struct Walker<'value, 'ctx: 'value>(&'value str, PhantomData<&'ctx ()>); +pub struct Walker<'value>(&'value str); -impl<'value, 'ctx: 'value, VisitorErr: 'ctx> crate::Walker<'value, 'ctx, VisitorErr> - for Walker<'value, 'ctx> +impl<'value, 'borrow: 'value, 'ctx: 'borrow, VisitorErr: 'value> crate::Walker<'value, 'ctx, VisitorErr> + for Walker<'borrow> { type Error = BasicError; @@ -45,8 +45,8 @@ impl<'value, 'ctx: 'value, VisitorErr: 'ctx> crate::Walker<'value, 'ctx, Visitor } } -impl<'value, 'ctx: 'value, VisitorErr: 'ctx> WalkerHints<'value, 'ctx, VisitorErr> - for Walker<'value, 'ctx> +impl<'value, 'borrow: 'value, 'ctx: 'borrow, VisitorErr: 'value> WalkerHints<'value, 'ctx, VisitorErr> + for Walker<'borrow> { type Error = BasicError; @@ -61,8 +61,8 @@ impl<'value, 'ctx: 'value, VisitorErr: 'ctx> WalkerHints<'value, 'ctx, VisitorEr } } -impl<'value, 'ctx: 'value, VisitorErr: 'ctx> Hint<'value, 'ctx, Reference<str>, VisitorErr> - for Walker<'value, 'ctx> +impl<'value, 'borrow: 'value, 'ctx: 'borrow, VisitorErr: 'value> Hint<'value, 'ctx, Reference<str>, VisitorErr> + for Walker<'borrow> { type Error = BasicError; @@ -93,20 +93,40 @@ impl<'value, 'ctx: 'value, VisitorErr: 'ctx> Hint<'value, 'ctx, Reference<str>, } } -impl<'value, 'ctx: 'value, VisitorErr: 'ctx> WalkMut<'value, 'ctx, VisitorErr> for str { - type ErrorMut = BasicError; - type WalkerMut = Walker<'value, 'ctx>; - - fn walker_mut(&'value mut self) -> Self::WalkerMut { - Walker(self, PhantomData) - } -} - -impl<'value, 'ctx: 'value, VisitorErr: 'ctx> Walk<'value, 'ctx, VisitorErr> for str { +// impl<'value, 'ctx: 'value, VisitorErr: 'ctx> WalkMut<'value, 'ctx, VisitorErr> for str { +// type ErrorMut = BasicError; +// type WalkerMut = Walker<'value, 'ctx>; +// +// fn walker_mut(&'value mut self) -> Self::WalkerMut { +// Walker(self, PhantomData) +// } +// } + +// impl<'value, 'borrow: 'value, 'ctx: 'borrow, VisitorErr: 'value> Walk<'value, 'borrow, 'ctx, VisitorErr> for str { +// type Error = BasicError; +// type Walker = Walker<'borrow>; +// +// fn walker(&'borrow self) -> Self::Walker { +// Walker(self) +// } +// } + +impl<'value, 'borrow: 'value, 'ctx: 'borrow, VisitorErr: 'value> Walk<'value, 'borrow, 'ctx, VisitorErr> for str { type Error = BasicError; - type Walker = Walker<'value, 'ctx>; + type Walker = Walker<'borrow>; - fn walker(&'value self) -> Self::Walker { - Walker(self, PhantomData) + fn walker(&'borrow self) -> Self::Walker { + Walker(self) } } + +// +// impl<'value, 'ctx: 'value, VisitorErr: 'value> Walk<'value, 'value, 'ctx, VisitorErr> for i32 { +// type Error = BasicError; +// type Walker = Walker<'value, 'ctx>; +// +// fn walker(&'value self) -> Self::Walker { +// // Walker(self, PhantomData) +// todo!() +// } +// } |