shape-runtime 0.2.0

Bytecode compiler, builtins, and runtime infrastructure for Shape
Documentation
/// @module std::core::try_into
/// Fallible conversion trait used by `as Type?`.
///
/// Dispatch uses named impl selectors (`as <TypeName>`) so conversions are
/// statically validated and resolved without primitive conversion tables.

/// Define a fallible conversion from `Self` into `Target`.
///
/// @see std::core::try_from::TryFrom
trait TryInto<Target> {
    /// Attempt to convert `self` into `Target`.
    tryInto(): Result<Target, AnyError>
}

impl TryInto<number> for int as number {
    method tryInto() { self as number? }
}

impl TryInto<decimal> for int as decimal {
    method tryInto() { self as decimal? }
}

impl TryInto<string> for int as string {
    method tryInto() { self as string? }
}

impl TryInto<bool> for int as bool {
    method tryInto() { self as bool? }
}

impl TryInto<int> for number as int {
    method tryInto() { self as int? }
}

impl TryInto<decimal> for number as decimal {
    method tryInto() { self as decimal? }
}

impl TryInto<string> for number as string {
    method tryInto() { self as string? }
}

impl TryInto<bool> for number as bool {
    method tryInto() { self as bool? }
}

impl TryInto<number> for decimal as number {
    method tryInto() { self as number? }
}

impl TryInto<int> for decimal as int {
    method tryInto() { self as int? }
}

impl TryInto<string> for decimal as string {
    method tryInto() { self as string? }
}

impl TryInto<bool> for decimal as bool {
    method tryInto() { self as bool? }
}

impl TryInto<int> for string as int {
    method tryInto() { self as int? }
}

impl TryInto<number> for string as number {
    method tryInto() { self as number? }
}

impl TryInto<decimal> for string as decimal {
    method tryInto() { self as decimal? }
}

impl TryInto<bool> for string as bool {
    method tryInto() { self as bool? }
}

impl TryInto<int> for bool as int {
    method tryInto() { self as int? }
}

impl TryInto<number> for bool as number {
    method tryInto() { self as number? }
}

impl TryInto<decimal> for bool as decimal {
    method tryInto() { self as decimal? }
}

impl TryInto<string> for bool as string {
    method tryInto() { self as string? }
}