Fragment

trait Fragment[T, +E] extends UrlPart[T, E]

Represents the fragment (or ref) of an URL, containing an information of type T, or an error of type E.

Represents the fragment (or ref) of an URL, containing an information of type T, or an error of type E.

Type Params
E

type of the error that this PathSegment produces on "illegal" url paths.

T

type represented by this PathSegment

Companion
object
trait UrlPart[T, E]
class Object
trait Matchable
class Any

Value members

Abstract methods

Creates a fragment information from an instance of T.

Creates a fragment information from an instance of T.

def matchFragment(maybeFragment: MaybeFragment): Either[E, T]

Extract the information contained in this fragment, as an instance of T.

Extract the information contained in this fragment, as an instance of T.

Value Params
maybeFragment

raw fragment information from the URL

Returns

Right a T when the extraction was successful, and Left an error otherwise.

Concrete methods

def ?: Fragment[Option[T], E]

Turns this fragment matching a T into a fragment matching an Option of T. It will return Some(t) if t could be extracted, and None otherwise.

Turns this fragment matching a T into a fragment matching an Option of T. It will return Some(t) if t could be extracted, and None otherwise.

The failure that happened and led to an error does not matter: it will result in None, no matter what.

def as[U](tToU: T => U, uToT: U => T): Fragment[U, E]

By-map this fragment into a type U.

By-map this fragment into a type U.

def as[U](codec: Codec[T, U]): Fragment[U, E]
def createPart(t: T, encoder: UrlStringGenerator): String
final def filter[E1 >: E](predicate: T => Boolean, error: MaybeFragment => E1): Fragment[T, E1]

Adds an extra satisfying criteria to the de-serialized output of this Fragment. When the output of this Fragment does not satisfy the given predicate, the given error is returned instead.

Adds an extra satisfying criteria to the de-serialized output of this Fragment. When the output of this Fragment does not satisfy the given predicate, the given error is returned instead.

Type Params
E1

new type of the error

Value Params
error

error happening when it's not the case

predicate

criteria that the output has to verify

Returns

a new Fragment matching the same fragment information, but only when the predicate is satisfied

final def filter(predicate: T => Boolean)(ev: E <:< DummyError): Fragment[T, DummyError]

Sugar when T =:= DummyError.

Sugar when T =:= DummyError.

def fragmentString(t: T, encoder: UrlStringGenerator): String

Creates the Fragment string contained in the given instance of T. Automatically prepend # if non empty.

Creates the Fragment string contained in the given instance of T. Automatically prepend # if non empty.

def fragmentString(ev: Unit =:= T): String

Sugar when

Sugar when

T =:= Unit

. T =:= Unit }}}

final def getOrElse[U](default: => U)(ev: T =:= Option[U]): Fragment[U, E]

Returns a Fragment which outputs the contents of this Fragment when result is a Some and the specified default value otherwise. When generating the path, it will only generate paths corresponding to the Some case.

Returns a Fragment which outputs the contents of this Fragment when result is a Some and the specified default value otherwise. When generating the path, it will only generate paths corresponding to the Some case.

Value Params
default

default value when output is empty

Note

This method is only available when T =:= Option[U].

def matchRawUrl(url: String, urlStringParserGenerator: UrlStringParserGenerator): Either[E, T]

Inherited methods

final def createPart(ev: Unit =:= T): String

Sugar when T =:= Unit

Sugar when T =:= Unit

Inherited from
UrlPart
final def createPart(encoder: UrlStringGenerator)(ev: Unit =:= T): String

Sugar when T =:= Unit

Sugar when T =:= Unit

Inherited from
UrlPart