Parts

object Parts

The public user API for specifying the required and optional parts of a directive (arguments, fields or body) together with optional converter/validator functions.

class Object
trait Matchable
class Any
Parts.type

Value members

Concrete methods

def argument[T](convert: SourceFragment => Either[String, T], withWS: Boolean): DirectivePartBuilder[T]

Specifies a required argument.

Specifies a required argument.

Value parameters:
convert

the function to use for converting and validating the parsed value

withWS

whether the argument supports whitespace characters (only one of these can exist in any single directive markup)

Returns:

a directive part that can be combined with further parts with the ~ operator

Specifies standard block-level content as the body of the directive.

Specifies standard block-level content as the body of the directive.

Returns:

a directive part that can be combined with further parts with the ~ operator

def content[T](f: SourceFragment => Either[String, T]): DirectivePartBuilder[T]

Specifies that the body of the directive markup should get passed to the conversion function as a raw string.

Specifies that the body of the directive markup should get passed to the conversion function as a raw string.

Value parameters:
f

the function to use for converting and validating the parsed value

Returns:

a directive part that can be combined with further parts with the ~ operator

def field[T](name: String, convert: SourceFragment => Either[String, T]): DirectivePartBuilder[T]

Specifies a required named field.

Specifies a required named field.

Value parameters:
convert

the function to use for converting and validating the parsed value

name

the name of the field as used in the directive markup (without the colons)

Returns:

a directive part that can be combined with further parts with the ~ operator

def optArgument[T](convert: SourceFragment => Either[String, T], withWS: Boolean): DirectivePartBuilder[Option[T]]

Specifies an optional argument.

Specifies an optional argument.

Value parameters:
convert

the function to use for converting and validating the parsed value if it is present

withWS

whether the argument supports whitespace characters (only one of these can exist in any single directive markup)

Returns:

a directive part that can be combined with further parts with the ~ operator

def optField[T](name: String, convert: SourceFragment => Either[String, T]): DirectivePartBuilder[Option[T]]

Specifies an optional named field.

Specifies an optional named field.

Value parameters:
convert

the function to use for converting and validating the parsed value if it is present

name

the name of the field as used in the directive markup (without the colons)

Returns:

a directive part that can be combined with further parts with the ~ operator