middleware_decoding(f): apply with .pipe. The schema decodes
with the services f needs (R): f gets the parse needing the
schema's own (RI) and may provide them.
Functions#
__init__#
__init__(f) -> None| Parameter | Type | Description |
|---|---|---|
f | Callable[[Parse[A, RI_contra], ParseOptions], Parse[A, R_co]] |
def __init__(self, f: Callable[[Parse[A, RI_contra], ParseOptions], Parse[A, R_co]]) -> None:
self._f = f__call__#
__call__[E, RE = Never](schema) -> Bottom[A, E, R_co, RE]| Parameter | Type | Description |
|---|---|---|
schema | Codec[A, E, RI_contra, RE] |
Returns Bottom[A, E, R_co, RE]
def __call__[E, RE = Never](
self, schema: Codec[A, E, RI_contra, RE], /
) -> Bottom[A, E, R_co, RE]:
node = schema.__codec__().ast
return Bottom(ast.decode_to(node, node.to_type(), Middleware(self._f, unchanged)))