kosei28/maru/typed does not have a README file

Length

pub(open) trait Length {
fn length(Self) -> Int
}

Types that have a length, used by nonempty, min_len, max_len, and len.
impl Length for String
impl Length for Array[T]

Remainder

pub(open) trait Remainder {
fn rem(Self, Self) -> Self
}

Numbers that support remainder, used by multiple_of.
impl Remainder for Int
impl Remainder for Int64
impl Remainder for Double

Zero

pub(open) trait Zero {
fn zero() -> Self
}

Numeric zero, used by positive and related checks.
impl Zero for Int
impl Zero for Int64
impl Zero for Double

Typed

type Typed[T]

A converted value that still carries its JSON path.

Typed::base64

fn Typed::base64(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to be standard Base64.

Typed::date

fn Typed::date(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to be an ISO 8601 date (YYYY-MM-DD).

Typed::datetime

fn Typed::datetime(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to be an ISO 8601 datetime.

Typed::email

fn Typed::email(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to look like an email address.

Typed::ends_with

fn Typed::ends_with(self : Typed[String], suffix : String) -> Typed[String] raise
Invalid

Require a string to end with suffix.

Typed::eq

fn[T : Eq + Show] Typed::eq(self : Typed[T], expected : T) -> Typed[T] raise
Invalid

Require self == expected.

Typed::gt

fn[T : Compare + Show + Eq] Typed::gt(self : Typed[T], bound : T) -> Typed[T] raise
Invalid

Require self > bound.

Typed::includes

fn Typed::includes(self : Typed[String], part : String) -> Typed[String] raise
Invalid

Require a string to contain part.

Typed::ipv4

fn Typed::ipv4(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to look like an IPv4 address.

Typed::ipv6

fn Typed::ipv6(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to look like an IPv6 address.

Typed::len

fn[T : Length] Typed::len(self : Typed[T], n : Int) -> Typed[T] raise
Invalid

Require an exact length for strings and arrays.

Typed::lowercase

fn Typed::lowercase(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to be lowercase.

Typed::lt

fn[T : Compare + Show + Eq] Typed::lt(self : Typed[T], bound : T) -> Typed[T] raise
Invalid

Require self < bound.

Typed::map

fn[A, B] Typed::map(self : Typed[Array[A]], f : (A) -> B raise?) -> Typed[Array[B]] raise?

Map each array element. Errors keep the element's path.

Typed::max

fn[T : Compare + Show + Eq] Typed::max(self : Typed[T], bound : T) -> Typed[T] raise
Invalid

Require self <= bound.

Typed::max_len

fn[T : Length] Typed::max_len(self : Typed[T], n : Int) -> Typed[T] raise
Invalid

Require a maximum length for strings and arrays.

Typed::min

fn[T : Compare + Show + Eq] Typed::min(self : Typed[T], bound : T) -> Typed[T] raise
Invalid

Require self >= bound.

Typed::min_len

fn[T : Length] Typed::min_len(self : Typed[T], n : Int) -> Typed[T] raise
Invalid

Require a minimum length for strings and arrays.

Typed::multiple_of

fn[T : Remainder + Zero + Eq + Show] Typed::multiple_of(self : Typed[T], n : T) -> Typed[T] raise
Invalid

Require self to be a multiple of n.

Typed::negative

fn[T : Compare + Zero + Eq] Typed::negative(self : Typed[T]) -> Typed[T] raise
Invalid

Require self < 0.

Typed::new

fn[T] Typed::new(val : T, path :
Path
) -> Typed[T]

Typed::nonempty

fn[T : Length] Typed::nonempty(self : Typed[T]) -> Typed[T] raise
Invalid

Reject empty strings and arrays.

Typed::nonnegative

fn[T : Compare + Zero + Eq] Typed::nonnegative(self : Typed[T]) -> Typed[T] raise
Invalid

Require self >= 0.

Typed::nonpositive

fn[T : Compare + Zero + Eq] Typed::nonpositive(self : Typed[T]) -> Typed[T] raise
Invalid

Require self <= 0.

Typed::positive

fn[T : Compare + Zero + Eq] Typed::positive(self : Typed[T]) -> Typed[T] raise
Invalid

Require self > 0.

Typed::range

fn[T : Compare + Show + Eq] Typed::range(self : Typed[T], min : T, max : T) -> Typed[T] raise
Invalid

Require min <= self <= max.

Typed::refine

fn[T] Typed::refine(self : Typed[T], predicate : (T) -> Bool, message : String) -> Typed[T] raise
Invalid

Apply a custom predicate. The message is used when it returns false.

Typed::regex

fn Typed::regex(self : Typed[String], pattern : String) -> Typed[String] raise
Invalid

Require a string to contain a MoonBit regex match. Use ^ and $ to require the whole string.

Typed::starts_with

fn Typed::starts_with(self : Typed[String], prefix : String) -> Typed[String] raise
Invalid

Require a string to start with prefix.

Typed::time

fn Typed::time(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to be an ISO 8601 time (HH:MM[:SS[.s+]]).

Typed::unique

fn[T : Eq] Typed::unique(self : Typed[Array[T]]) -> Typed[Array[T]] raise
Invalid

Require array elements to be unique.

Typed::uppercase

fn Typed::uppercase(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to be uppercase.

Typed::url

fn Typed::url(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to look like a URL.

Typed::uuid

fn Typed::uuid(self : Typed[String]) -> Typed[String] raise
Invalid

Require a string to look like a UUID.

Typed::value

fn[T] Typed::value(self : Typed[T]) -> T

Unwrap the converted value.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io