io.frontroute.ConjunctionMagnet.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of frontroute_sjs1_3.0.0-RC1 Show documentation
Show all versions of frontroute_sjs1_3.0.0-RC1 Show documentation
Router library based for Laminar with DSL inspired by Akka HTTP.
The newest version!
package io.frontroute
import app.tulz.tuplez.Composition
trait ConjunctionMagnet[L] {
type Out
def apply(underlying: Directive[L]): Out
}
object ConjunctionMagnet {
implicit def fromDirective[L, R](other: Directive[R])(implicit composition: Composition[L, R]): ConjunctionMagnet[L] { type Out = Directive[composition.Composed] } =
new ConjunctionMagnet[L] {
type Out = Directive[composition.Composed]
def apply(underlying: Directive[L]): Directive[composition.Composed] =
Directive[composition.Composed] { inner => (location, previous, state) =>
underlying.tapply { prefix => (location, previous, state) =>
other.tapply { suffix =>
inner(composition.compose(prefix, suffix))
}(location, previous, state.path("&"))
}(location, previous, state)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy