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.

Type parameters:
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 parameters:
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](implicit codec: Codec[T, U]): Fragment[U, E]
def createPart(t: T, encoder: UrlStringGenerator): String

Takes an instance of T and generate the part of the URL contained in this T

Takes an instance of T and generate the part of the URL contained in this T

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 parameters:
E1

new type of the error

Value parameters:
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)(implicit 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()(implicit ev: Unit =:= T): String

Sugar when

Sugar when

T =:= Unit

. T =:= Unit }}}

final def getOrElse[U](default: => U)(implicit 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 parameters:
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()(implicit ev: Unit =:= T): String

Sugar when T =:= Unit

Sugar when T =:= Unit

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

Sugar when T =:= Unit

Sugar when T =:= Unit

Inherited from:
UrlPart