pedantic
Types
pub type Codec(t) =
codec.Codec(t)
pub type Decoder(t) =
decode.Decoder(t)
pub type Encoder(t) =
encode.Encoder(t)
pub type Error =
report.Error
pub type ErrorKind =
report.ErrorKind
pub type IssueKind =
report.ErrorKind
pub type Path =
List(report.PathSegment)
pub type PathSegment =
report.PathSegment
pub type Report =
report.Report
pub type TypeField =
report.TypeField
pub type TypeGraph =
report.TypeGraph
pub type ValidationIssue =
report.Error
pub type ValidationReport =
report.Report
pub type ValidationWarning =
report.Warning
pub type Warning =
report.Warning
pub type WarningKind =
report.WarningKind
Values
pub fn allow_chars(
codec: codec.Codec(String),
characters: String,
) -> codec.Codec(String)
pub fn any_of(
decoders: List(decode.Decoder(t)),
) -> decode.Decoder(t)
pub fn assert_that(
codec: codec.Codec(t),
predicate: fn(t) -> Bool,
error: report.ErrorKind,
) -> codec.Codec(t)
pub const bool: codec.Codec(Bool)
pub fn build(
builder: codec.ObjectBuilder(value, value),
) -> codec.Codec(value)
pub fn check(
codec: codec.Codec(t),
predicate: fn(t) -> Bool,
msg: String,
) -> codec.Codec(t)
pub const coerced_bool: codec.Codec(Bool)
pub const coerced_float: codec.Codec(Float)
pub const coerced_int: codec.Codec(Int)
pub const coerced_string: codec.Codec(String)
pub fn collapse_whitespace(
codec: codec.Codec(String),
) -> codec.Codec(String)
pub fn custom(
decoder: decode.Decoder(t),
encoder: encode.Encoder(t),
) -> codec.Codec(t)
Creates a Codec by custom pairing a standalone Decoder and Encoder.
pub fn decode_json(
codec: codec.Codec(t),
json_string: String,
) -> Result(t, report.Report)
pub fn default(
codec: codec.Codec(option.Option(a)),
default_val: a,
) -> codec.Codec(a)
pub fn default_if_blank(
codec: codec.Codec(String),
default_value: String,
) -> codec.Codec(String)
pub const default_to: fn(codec.Codec(option.Option(i)), i) -> codec.Codec(
i,
)
pub fn describe(
codec: codec.Codec(t),
desc: String,
) -> codec.Codec(t)
pub fn dict(
value_codec: codec.Codec(a),
) -> codec.Codec(dict.Dict(String, a))
pub fn email(
codec: codec.Codec(String),
msg: String,
) -> codec.Codec(String)
pub fn empty_as_none(
codec: codec.Codec(String),
) -> codec.Codec(option.Option(String))
pub fn encode_json(codec: codec.Codec(t), val: t) -> String
pub const exact_bool: codec.Codec(Bool)
pub const exact_float: codec.Codec(Float)
pub const exact_int: codec.Codec(Int)
pub const exact_string: codec.Codec(String)
pub fn example(
codec: codec.Codec(t),
ex: dynamic.Dynamic,
) -> codec.Codec(t)
pub fn field(
builder: codec.ObjectBuilder(fn(field_type) -> next, value),
name: String,
field_codec: codec.Codec(field_type),
get: fn(value) -> field_type,
) -> codec.ObjectBuilder(next, value)
pub const float: codec.Codec(Float)
pub const int: codec.Codec(Int)
pub const key: fn(
codec.ObjectBuilder(fn(f) -> g, h),
String,
codec.Codec(f),
fn(h) -> f,
) -> codec.ObjectBuilder(g, h)
pub fn key_optional(
builder: codec.ObjectBuilder(
fn(option.Option(field_type)) -> next,
value,
),
name: String,
field_codec: codec.Codec(field_type),
get: fn(value) -> option.Option(field_type),
) -> codec.ObjectBuilder(next, value)
pub const key_required: fn(
codec.ObjectBuilder(fn(c) -> d, e),
String,
codec.Codec(c),
fn(e) -> c,
) -> codec.ObjectBuilder(d, e)
pub fn key_with_default(
builder: codec.ObjectBuilder(fn(field_type) -> next, value),
name: String,
field_codec: codec.Codec(field_type),
default_val: field_type,
get: fn(value) -> field_type,
) -> codec.ObjectBuilder(next, value)
pub fn length(
codec: codec.Codec(String),
len: Int,
) -> codec.Codec(String)
pub fn list(
element_codec: codec.Codec(a),
) -> codec.Codec(List(a))
pub fn lowercase(
codec: codec.Codec(String),
) -> codec.Codec(String)
pub fn map(
decoder: decode.Decoder(a),
transform_fn: fn(a) -> b,
) -> decode.Decoder(b)
pub fn max(
codec: codec.Codec(Int),
maximum: Int,
) -> codec.Codec(Int)
pub fn max_length(
codec: codec.Codec(String),
maximum: Int,
) -> codec.Codec(String)
pub fn max_size(
codec: codec.Codec(List(a)),
maximum: Int,
) -> codec.Codec(List(a))
pub fn min(
codec: codec.Codec(Int),
minimum: Int,
) -> codec.Codec(Int)
pub fn min_length(
codec: codec.Codec(String),
minimum: Int,
) -> codec.Codec(String)
pub fn min_size(
codec: codec.Codec(List(a)),
minimum: Int,
) -> codec.Codec(List(a))
pub fn negative(codec: codec.Codec(Int)) -> codec.Codec(Int)
pub fn non_empty_list(
element_codec: codec.Codec(a),
) -> codec.Codec(List(a))
pub fn non_negative(codec: codec.Codec(Int)) -> codec.Codec(Int)
pub fn non_positive(codec: codec.Codec(Int)) -> codec.Codec(Int)
pub fn normalize_email(
codec: codec.Codec(String),
) -> codec.Codec(String)
pub fn normalize_uuid(
codec: codec.Codec(String),
) -> codec.Codec(String)
pub fn object(
name: String,
constructor: constructor,
) -> codec.ObjectBuilder(constructor, a)
pub fn optional(
inner_codec: codec.Codec(a),
) -> codec.Codec(option.Option(a))
pub fn positive(codec: codec.Codec(Int)) -> codec.Codec(Int)
pub fn refine(
codec: codec.Codec(t),
rule: fn(t) -> Result(t, report.ErrorKind),
) -> codec.Codec(t)
pub fn remove_chars(
codec: codec.Codec(String),
characters: String,
) -> codec.Codec(String)
pub fn replace(
codec: codec.Codec(String),
pattern: String,
replacement: String,
) -> codec.Codec(String)
pub fn safe_parse(
codec: codec.Codec(t),
val: dynamic.Dynamic,
) -> Result(t, report.Report)
pub fn safe_parse_json(
codec: codec.Codec(t),
json_string: String,
) -> Result(t, report.Report)
pub const string: codec.Codec(String)
pub fn strip_control_chars(
codec: codec.Codec(String),
) -> codec.Codec(String)
pub fn title(
codec: codec.Codec(t),
name: String,
) -> codec.Codec(t)
pub fn trim(codec: codec.Codec(String)) -> codec.Codec(String)
pub const unwrap_or: fn(codec.Codec(option.Option(j)), j) -> codec.Codec(
j,
)
pub fn uppercase(
codec: codec.Codec(String),
) -> codec.Codec(String)
pub fn uuid(
codec: codec.Codec(String),
msg: String,
) -> codec.Codec(String)
pub fn with_error_formatter(
codec: codec.Codec(t),
formatter: fn(dynamic.Dynamic, report.ErrorKind) -> String,
) -> codec.Codec(t)
pub fn with_error_message(
codec: codec.Codec(t),
msg: String,
) -> codec.Codec(t)
pub fn with_template(
codec: codec.Codec(t),
template: String,
) -> codec.Codec(t)