Fix ambiguous constructors of context wrappers
This commit is contained in:
parent
2136192cf1
commit
df0e32b7d5
@ -20,7 +20,7 @@ impl<'ctx, Ctx: NodeRefContainer> DynamicDirectedBinaryTreeContextFromContext<&'
|
||||
}
|
||||
|
||||
impl<'ctx, Ctx: NodeRefContainer> DynamicDirectedBinaryTreeContextFromContext<&'ctx mut Ctx> {
|
||||
pub fn wrap(ctx: &'ctx mut Ctx, initialDirection: BinaryTreeDirection) -> Self {
|
||||
pub fn wrap_mut(ctx: &'ctx mut Ctx, initialDirection: BinaryTreeDirection) -> Self {
|
||||
return Self {
|
||||
ctx,
|
||||
dir: initialDirection,
|
||||
|
||||
@ -23,9 +23,17 @@ pub struct FixedRightDirectedBinaryTreeContextFromContext<CtxRef> {
|
||||
}
|
||||
|
||||
macro_rules! _constructor {
|
||||
($name:ident $($mut:tt)?) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx $($mut)? Ctx> {
|
||||
pub fn wrap(ctx: &'ctx $($mut)? Ctx) -> Self {
|
||||
($name:ident) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx Ctx> {
|
||||
pub fn wrap(ctx: &'ctx Ctx) -> Self {
|
||||
return Self { ctx };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($name:ident mut) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx mut Ctx> {
|
||||
pub fn wrap_mut(ctx: &'ctx mut Ctx) -> Self {
|
||||
return Self { ctx };
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,10 +37,10 @@ struct DynamicParent2NodeGetterClojureFromDirectedContext<CtxRef, NodeRef> {
|
||||
}
|
||||
|
||||
macro_rules! _constructor {
|
||||
($name:ident $direction:ident $($mut:tt)?) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx $($mut)? Ctx, Ctx::NodeRef> {
|
||||
pub fn wrap_not_root(
|
||||
ctx: &'ctx $($mut)? Ctx, node: Ctx::NodeRef, direction: $direction
|
||||
($name:ident $direction:ident) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx Ctx, Ctx::NodeRef> {
|
||||
pub fn wrapNode(
|
||||
ctx: &'ctx Ctx, node: Ctx::NodeRef, direction: $direction
|
||||
) -> Self {
|
||||
return Self {
|
||||
dir: Some(direction),
|
||||
@ -48,6 +48,39 @@ macro_rules! _constructor {
|
||||
node: _NodeOrNothing { node: ManuallyDrop::new(node) }
|
||||
};
|
||||
}
|
||||
|
||||
pub fn wrapRoot(
|
||||
ctx: &'ctx Ctx
|
||||
) -> Self {
|
||||
return Self {
|
||||
dir: None,
|
||||
ctx: ctx,
|
||||
node: _NodeOrNothing { nothing: () }
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
($name:ident $direction:ident mut) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx mut Ctx, Ctx::NodeRef> {
|
||||
pub fn wrapNode_mut(
|
||||
ctx: &'ctx mut Ctx, node: Ctx::NodeRef, direction: $direction
|
||||
) -> Self {
|
||||
return Self {
|
||||
dir: Some(direction),
|
||||
ctx: ctx,
|
||||
node: _NodeOrNothing { node: ManuallyDrop::new(node) }
|
||||
};
|
||||
}
|
||||
|
||||
pub fn wrapRoot_mut(
|
||||
ctx: &'ctx mut Ctx
|
||||
) -> Self {
|
||||
return Self {
|
||||
dir: None,
|
||||
ctx: ctx,
|
||||
node: _NodeOrNothing { nothing: () }
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -19,14 +19,14 @@ macro_rules! _mut_switch {
|
||||
|
||||
macro_rules! _struct {
|
||||
($name:ident) => {
|
||||
struct $name<CtxRef, NodeRef> {
|
||||
pub struct $name<CtxRef, NodeRef> {
|
||||
ctx: CtxRef,
|
||||
node: NodeRef,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
struct FixedRootParent2NodeGetterClojureFromContext<NodeRef> {
|
||||
pub struct FixedRootParent2NodeGetterClojureFromContext<NodeRef> {
|
||||
ctx: NodeRef,
|
||||
}
|
||||
_struct!(FixedLeftParent2NodeGetterClojureFromContext);
|
||||
@ -35,9 +35,17 @@ _struct!(FixedForwardParent2NodeGetterClojureFromDirectedContext);
|
||||
_struct!(FixedOppositeParent2NodeGetterClojureFromDirectedContext);
|
||||
|
||||
macro_rules! _constructor {
|
||||
($name:ident $($mut:tt)?) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx $($mut)? Ctx, Ctx::NodeRef> {
|
||||
pub fn wrap(ctx: &'ctx $($mut)? Ctx, node: Ctx::NodeRef) -> Self {
|
||||
($name:ident) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx Ctx, Ctx::NodeRef> {
|
||||
pub fn wrap(ctx: &'ctx Ctx, node: Ctx::NodeRef) -> Self {
|
||||
return Self { ctx, node };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
($name:ident mut) => {
|
||||
impl<'ctx, Ctx: NodeRefContainer> $name <&'ctx mut Ctx, Ctx::NodeRef> {
|
||||
pub fn wrap_mut(ctx: &'ctx mut Ctx, node: Ctx::NodeRef) -> Self {
|
||||
return Self { ctx, node };
|
||||
}
|
||||
}
|
||||
@ -53,7 +61,7 @@ impl<'ctx, Ctx: NodeRefContainer + BinaryTreeRootGetter>
|
||||
}
|
||||
|
||||
impl<'ctx, Ctx: NodeRefContainer> FixedRootParent2NodeGetterClojureFromContext<&'ctx mut Ctx> {
|
||||
fn wrap(ctx: &'ctx mut Ctx) -> Self {
|
||||
fn wrap_mut(ctx: &'ctx mut Ctx) -> Self {
|
||||
return Self { ctx };
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
pub mod clojure;
|
||||
mod fixed_wrapper;
|
||||
mod dynamic_wrappers;
|
||||
pub mod fixed_wrapper;
|
||||
pub mod dynamic_wrappers;
|
||||
Loading…
Reference in New Issue
Block a user