BoolSeg

zio.blocks.endpoint.SegmentCodec.BoolSeg
final case class BoolSeg[N <: String](name: N, doc: Doc = ..., examples: Chunk[(String, Boolean)] = ...) extends SegmentCodec[Boolean]

Attributes

Source
SegmentCodec.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait SegmentCodec[Boolean]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Types

Phantom capture marker: SegmentCodec.NoPathVars when this segment captures nothing (empty and literal segments), SegmentCodec.HasPathVars when it captures a value (bool, int, long, string, UUID, trailing, and any composition containing one of those). This is a second, parallel type track: it never affects A (the runtime-decoded value type) and has zero runtime footprint. Its only consumer is PathCodec.orElse, which requires both branches to be NoPathVars so a capturing codec mapped to Unit is rejected at the call site instead of failing expand at runtime.

Phantom capture marker: SegmentCodec.NoPathVars when this segment captures nothing (empty and literal segments), SegmentCodec.HasPathVars when it captures a value (bool, int, long, string, UUID, trailing, and any composition containing one of those). This is a second, parallel type track: it never affects A (the runtime-decoded value type) and has zero runtime footprint. Its only consumer is PathCodec.orElse, which requires both branches to be NoPathVars so a capturing codec mapped to Unit is rejected at the call site instead of failing expand at runtime.

Attributes

Source
SegmentCodec.scala

Value members

Concrete methods

def unused: PathCodec[Unit] { type PathVars = HasPathVars; }

Marks this capture as intentionally unused: the route keeps matching the same true/false shape and keeps rendering {name}, but decoding yields Unit, so no handler parameter is required for it. Lifts into a PathCodec exactly like SegmentCodec.transform.

Marks this capture as intentionally unused: the route keeps matching the same true/false shape and keeps rendering {name}, but decoding yields Unit, so no handler parameter is required for it. Lifts into a PathCodec exactly like SegmentCodec.transform.

Attributes

Source
SegmentCodec.scala

Inherited methods

final def format(value: Boolean): Path

Attributes

Inherited from:
SegmentCodec
Source
SegmentCodec.scala
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala
final def render(prefix: String = ..., suffix: String = ...): String

Attributes

Inherited from:
SegmentCodec
Source
SegmentCodec.scala
final def transform[B, PV](decode: Boolean => B, encode: B => Boolean)(implicit ev: CombinePathVars[PathVars, NoPathVars, PV]): PathCodec[B] { type PathVars = PV; }

Maps the decoded segment value into a domain type, lifting into a PathCodec.

Maps the decoded segment value into a domain type, lifting into a PathCodec.

Example: SegmentCodec.string("id").transform(CustomerId(_), _.value)

Value parameters

decode

maps the decoded segment value into the exposed type

encode

maps the exposed type back into the original segment representation used by format

Attributes

Returns

a path codec with the transformed value type and the same route shape as self

Inherited from:
SegmentCodec
Source
SegmentCodec.scala
final def transformOrFail[B, PV](decode: Boolean => Either[String, B], encode: B => Either[String, Boolean])(implicit ev: CombinePathVars[PathVars, NoPathVars, PV]): PathCodec[B] { type PathVars = PV; }

Effectfully maps the decoded segment value into a domain type, lifting into a PathCodec. decode returning Left causes path decoding / matching to fail; encode returning Left is propagated as the Left result of format.

Effectfully maps the decoded segment value into a domain type, lifting into a PathCodec. decode returning Left causes path decoding / matching to fail; encode returning Left is propagated as the Left result of format.

Example: SegmentCodec.string("id").transformOrFail(CustomerId.parse, id => Right(id.value))

Attributes

Inherited from:
SegmentCodec
Source
SegmentCodec.scala
final def ~[C, PVC](that: String)(implicit combiner: WithOut[Boolean, Unit, C], pathVarsCombiner: CombinePathVars[PathVars, NoPathVars, PVC]): SegmentCodec[C] { type PathVars = PVC; }

Composes a physical segment with a literal suffix (for example string("word") ~ "!"). The literal is validated exactly like SegmentCodec.literal (empty, /-carrying, or encoding-requiring values are rejected with IllegalArgumentException).

Composes a physical segment with a literal suffix (for example string("word") ~ "!"). The literal is validated exactly like SegmentCodec.literal (empty, /-carrying, or encoding-requiring values are rejected with IllegalArgumentException).

Attributes

Inherited from:
SegmentCodec
Source
SegmentCodec.scala
final def ~[B, C, PV2, PVC](that: SegmentCodec[B] { type PathVars = PV2; })(implicit combiner: WithOut[Boolean, B, C], pathVarsCombiner: CombinePathVars[PathVars, PV2, PVC]): SegmentCodec[C] { type PathVars = PVC; }

Composes two physical segments into one (for example int("n") ~ literal("-") ~ string("rest")).

Composes two physical segments into one (for example int("n") ~ literal("-") ~ string("rest")).

Adjacent string ~ string, numeric ~ numeric (Int/Long in any order, including through a flattened combined tail), and anything involving Trailing are rejected at runtime with IllegalArgumentException (ambiguous splits); put a literal, bool, or UUID segment between them.

The result's PathVars is the logical OR of both sides (computed by the pathVarsCombiner implicit, which defaults conservatively to HasPathVars when either side's marker is unknown), so orElse keeps rejecting compositions that capture.

Attributes

Inherited from:
SegmentCodec
Source
SegmentCodec.scala