Diffstat (limited to 'src/build.rs')
-rw-r--r--src/build.rs23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/build.rs b/src/build.rs
index d4dc676..8b34512 100644
--- a/src/build.rs
+++ b/src/build.rs
@@ -1,32 +1,21 @@
use crate::Visitor;
/// A type buildable from a walker.
-pub trait Build<'value, 'ctx>: Sized {
- type Error;
-
+pub trait Build<'ctx> {
/// The builder that can be used to build a value.
- type Builder: Builder<'value, 'ctx, Value = Self, Error = Self::Error>;
+ type Builder: Builder<'ctx, Value = Self>;
}
/// Extension to [`Visitor`] that allows constructing and finishing the visitor.
-pub trait Builder<'value, 'ctx> {
+pub trait Builder<'ctx>: Default {
type Error;
/// Type to be built.
- type Value: Sized;
-
- /// Init a new builder.
- fn init() -> Self
- where
- Self: Sized;
+ type Value;
/// As a visitor.
- fn as_visitor<WalkerErr: 'value>(
- &mut self,
- ) -> &mut dyn Visitor<'value, 'ctx, WalkerErr, Error = Self::Error>;
+ fn as_visitor(&mut self) -> &mut dyn Visitor<'ctx>;
/// Finish the value.
- fn finish(self) -> Result<Self::Value, Self::Error>
- where
- Self: Sized;
+ fn build(self) -> Result<Self::Value, Self::Error>;
}