pathPrefix("ball") {
pathEnd {
complete("/ball")
} ~
path(IntNumber) { int =>
complete(if (int % 2 == 0) "even ball" else "odd ball")
}
}
这里有什么'〜'符号
答案 0 :(得分:1)
我假设您在Spray / Akka-HTTP上引用了---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-81-277aa1d02ff0> in <module>()
2
3 # Get the covariances
----> 4 np.cov(label0, rowvar=False)
C:\Users\Matheus\Anaconda3\lib\site-packages\numpy\lib\function_base.py in cov(m, y, rowvar, bias, ddof, fweights, aweights)
3062 w *= aweights
3063
-> 3064 avg, w_sum = average(X, axis=1, weights=w, returned=True)
3065 w_sum = w_sum[0]
3066
C:\Users\Matheus\Anaconda3\lib\site-packages\numpy\lib\function_base.py in average(a, axis, weights, returned)
1143
1144 if returned:
-> 1145 if scl.shape != avg.shape:
1146 scl = np.broadcast_to(scl, avg.shape).copy()
1147 return avg, scl
AttributeError: 'float' object has no attribute 'shape'
方法。它的作用是将两条路线连在一起:
~
在Spray中,/**
* Returns a Route that chains two Routes. If the first Route rejects the request the second route is given a
* chance to act upon the request.
*/
def ~(other: Route): Route = { ctx ⇒
route {
ctx.withRejectionHandling { rejections ⇒
other(ctx.withRejectionsMapped(rejections ++ _))
}
}
是接受Route
并返回RequestContext
的函数的类型别名:
Unit
在Akka-HTTP中,它返回type Route = RequestContext ⇒ Unit
:
Future[RouteResult]