Skip to main content

BuiltinId

Enum BuiltinId 

Source
pub enum BuiltinId {
Show 111 variants Length, Format, ParseInt, ParseFloat, Chr, Abs, Sqrt, Min, Max, Floor, Ceil, Round, Pow, Decimal, Complex, Modular, Quantity, Money, SetRate, ToCurrency, SetRates, Uuid, UuidNil, UuidMax, UuidVersion, UuidDns, UuidUrl, UuidOid, UuidX500, TextBytes, TextFromBytes, WireBytes, ReadWireProgram, WriteWireResidual, UuidBytes, UuidFromBytes, Convert, ParseTimestamp, FormatTimestamp, YearOf, MonthOf, DayOf, WeekdayOf, HourOf, MinuteOf, SecondOf, WeekOf, QuarterOf, DateOf, TimeOf, LocalInstant, SecondsBetween, MonthsBetween, YearsBetween, AddSeconds, InZone, Copy, CountOnes, RunAccepted, Word32, Word64, Rotl, Rotr, Wand, Wor, Wnot, Lanes4Word32Make, Lanes4Of, SeqOfLanes4W32, Sha1Rnds4, Sha1Msg1, Sha1Msg2, Sha1Nexte, Lanes16Word8Make, SeqOfLanes16W8, Splat16Word8, Shuffle16, ShrBytes16, InterleaveLo16, InterleaveHi16, ByteAdd16, Maddubs16, Packus16, Lanes8Word32, SeqOfLanes8, Splat8Word32, IntOfWord32, IntOfWord64, Word64Shl, Word64Shr, Word64And, Word32Shr, Word16Make, IntOfWord16, Lanes4Word64, SeqOfLanes4, Mul32x32To64, HsumLanes4, Splat4Word64, AndNot4, Lanes16Word16, SeqOfLanes16, Splat16Word16, Mulhi16, Montmul32, NttBcastLo, NttBcastHi, NttBlend, MapOf, SetOf, RepeatSeq,
}

Variants§

§

Length

§

Format

§

ParseInt

§

ParseFloat

§

Chr

§

Abs

§

Sqrt

§

Min

§

Max

§

Floor

§

Ceil

§

Round

§

Pow

§

Decimal

decimal(text) / decimal(int) — construct an exact base-10 fixed-point (money) from its literal text (decimal("19.99")) or an integer. The non-breaking entry into the Decimal tower (it does NOT change how 19.99 literals parse).

§

Complex

complex(re, im) — construct an exact complex number from two exact reals. complex(0, 1) is the imaginary unit i; complex(0,1) * complex(0,1) = −1.

§

Modular

modular(value, modulus) — construct an element of ℤ/nℤ (the value reduced mod n).

§

Quantity

quantity(value, "unit") — construct a dimensioned physical quantity (quantity(2, "inch")). The magnitude rides the exact rational tower; the unit name resolves through the catalog.

§

Money

money(amount, "USD") — construct an exact monetary amount, quantised to the currency’s minor unit. The amount rides the Decimal tower (never float-drifts); the code resolves through the ISO-4217 catalog.

§

SetRate

set_rate("EUR", 1.10) — install/replace one exchange rate (vs the reference) in the ambient rate context that <money> in <currency> reads. A side effect; returns nothing.

§

ToCurrency

to_currency(money, "EUR") — convert money to another currency via the ambient rate context (exact). Errors if no rates are in scope or the currency is unknown. Surface: <money> in EUR.

§

SetRates

set_rates(map) — bulk-install a whole exchange-rate table from a Map of Text to <number> (code → rate vs the reference) into the ambient rate context. The bridge a literal, network-synced, or fetched rate table feeds. A side effect; returns nothing.

§

Uuid

uuid("550e8400-…") — parse a UUID from text (canonical/simple/braced/urn); error on a bad id.

§

UuidNil

uuid_nil() / uuid_max() — the two special ids.

§

UuidMax

§

UuidVersion

uuid_version(u) — the version nibble (0 nil, 1–8, 15 max).

§

UuidDns

The well-known namespace ids: uuid_dns(), uuid_url(), uuid_oid(), uuid_x500().

§

UuidUrl

§

UuidOid

§

UuidX500

§

TextBytes

Byte-level primitives that let the UUID version constructors be written IN LOGOS (uuid.lg): text_bytes is a Text’s UTF-8 bytes; uuid_bytes/uuid_from_bytes convert a Uuid to/from its 16 bytes. (md5/sha1/uuid_v3/uuid_v5 are Logos stdlib functions now, not builtins.)

§

TextFromBytes

text_from_bytes(seq) — the exact inverse of text_bytes: rebuild a Text from its UTF-8 Seq of Int. The wire medium for the Core-IR codec (Seq of Int) carries Text this way.

§

WireBytes

wireBytes(value) — the value’s plain wire form (peer codec encode_value_raw) as a Seq of Int. Lets the host serialize a program AST for a compile-once native PE, byte- identical to what the native binary’s generated wire_decode reads.

§

ReadWireProgram

readWireProgram() — read ONE length-framed CProgram from stdin (u32 LE length, then that many wire bytes, decoded via the generated wire_decode) and return it; on EOF the process exits cleanly (the resident-server loop terminator). AOT-only (returns the generated CProgram); the interpreter variant rebuilds a RuntimeValue for parity.

§

WriteWireResidual

writeWireResidual(text) — write text back as a length-framed residual (u32 LE length, then the UTF-8 bytes) to stdout and flush, returning the byte count. The response half of the resident PE server’s request/response protocol.

§

UuidBytes

§

UuidFromBytes

§

Convert

convert(quantity, "unit") — re-express a quantity in another unit of the SAME dimension (convert(q, "foot")); a different dimension is a clean error (the forbidden cast).

§

ParseTimestamp

parse_timestamp("2024-03-10T07:30:00Z") — parse an RFC 3339 / ISO 8601 timestamp into a Moment (nanoseconds since the epoch). The wire-first “the timestamp is its own type” entry.

§

FormatTimestamp

format_timestamp(moment) — render a Moment as an RFC 3339 / ISO 8601 UTC string.

§

YearOf

Calendar component extractors on a Moment (UTC), each returning an Int: year_of / month_of (1–12) / day_of (1–31) / weekday_of (0 = Sunday … 6 = Saturday).

§

MonthOf

§

DayOf

§

WeekdayOf

§

HourOf

§

MinuteOf

§

SecondOf

§

WeekOf

week_of(moment) — the ISO-8601 week number (1..=53) of the Moment/Date (UTC).

§

QuarterOf

quarter_of(moment) — the calendar quarter (1..=4) of the Moment/Date (UTC).

§

DateOf

date_of(moment) — the calendar day (a Date) the Moment falls on (UTC); identity on a Date.

§

TimeOf

time_of(moment) — the wall-clock time-of-day (a Time) of the Moment (UTC).

§

LocalInstant

local_instant(moment, "zone") — the local-as-UTC instant in a named zone (the lowering target for the <comp> of <m> in "<zone>", so every extractor reads the LOCAL component).

§

SecondsBetween

seconds_between(a, b) — whole seconds from Moment a to Moment b (signed Int).

§

MonthsBetween

months_between(a, b) / years_between(a, b) — complete calendar months/years (signed Int).

§

YearsBetween

§

AddSeconds

add_seconds(moment, n) — the Moment n seconds after moment.

§

InZone

in_zone(moment, "America/New_York") — the local wall-clock time (with offset) of a Moment in a named IANA zone, as Text. The natural surface is <moment> in "<zone>".

§

Copy

§

CountOnes

§

RunAccepted

§

Word32

word32(n) / word64(n) — construct a fixed-width wrapping integer from an Int.

§

Word64

§

Rotl

rotl(w, n) / rotr(w, n) — rotate a word left/right by n bits.

§

Rotr

§

Wand

word_and(a, b) / word_or(a, b) / word_not(a) — bitwise ops on the Word ring, CONSISTENT across every tier (the and/or keywords are logical short-circuit on the VM, so word crypto written in Logos — MD5/SHA-1 round functions — uses these instead).

§

Wor

§

Wnot

§

Lanes4Word32Make

The SHA-1 SHA-NI lane vocabulary: lanes4Word32(s)/seqOfLanes4W32(v) pack/unpack a Lanes4Word32 (128-bit), and sha1rnds4/sha1msg1/sha1msg2/sha1nexte are the four SHA-1 operations — the primitives a SHA-1 written IN LOGOS is built from (AOT → hardware sha1rnds4).

§

Lanes4Of

Pack four Word32s straight into a lane register — the alloc-free constructor (no Seq).

§

SeqOfLanes4W32

§

Sha1Rnds4

§

Sha1Msg1

§

Sha1Msg2

§

Sha1Nexte

§

Lanes16Word8Make

Byte-shuffle lane (Lanes16Word8 = one __m128i): pack/unpack + shuffle (pshufb), per-byte shift, and the two interleaves — the vocabulary a SIMD hex codec WRITTEN in Logos is built from.

§

SeqOfLanes16W8

§

Splat16Word8

§

Shuffle16

§

ShrBytes16

§

InterleaveLo16

§

InterleaveHi16

§

ByteAdd16

§

Maddubs16

§

Packus16

§

Lanes8Word32

lanes8Word32(s) — pack the first 8 Word32s of a Seq into a SIMD lane vector.

§

SeqOfLanes8

seqOfLanes8(v) — unpack a Lanes8Word32 back into a Seq of 8 Word32.

§

Splat8Word32

splat8Word32(x) — broadcast a Word32 into all 8 lanes.

§

IntOfWord32

intOfWord32(w) — the unsigned value of a Word32 as an Int (for byte serialization).

§

IntOfWord64

intOfWord64(w) — the value of a Word64 as an Int (byte-masked lanes in Keccak squeeze).

§

Word64Shl

word64Shl(w, n) — logical shift-left of a Word64 (Keccak lane byte-packing).

§

Word64Shr

word64Shr(w, n) — logical shift-right of a Word64 (Keccak squeeze byte-extract).

§

Word64And

word64And(a, b) — bitwise AND of two Word64s (Keccak χ’s ¬b ∧ c).

§

Word32Shr

word32Shr(w, n) — logical shift-right of a Word32 (SHA-256’s σ0/σ1, a non-rotating shift where the vacated high bits are zero).

§

Word16Make

word16(n) — the low 16 bits of an Int as a Word16 (ℤ/2¹⁶ coefficient).

§

IntOfWord16

intOfWord16(w) — the unsigned value of a Word16 as an Int (0..2¹⁶−1).

§

Lanes4Word64

lanes4Word64(s) — pack the first 4 Word64/Ints of a Seq into a Lanes4Word64.

§

SeqOfLanes4

seqOfLanes4(v) — unpack a Lanes4Word64 into a Seq of 4 Int lanes.

§

Mul32x32To64

mul32x32to64(a, b) — lane-wise widening multiply of the low 32 bits (vpmuludq).

§

HsumLanes4

hsumLanes4(v) — the horizontal sum of a lane vector’s lanes as an Int.

§

Splat4Word64

splat4Word64(x) — broadcast a Word64 into all 4 Keccak lanes (ι constant, χ all-ones).

§

AndNot4

andNot4(a, b) — 4-way Keccak χ’s (¬a) ∧ b in one lane op (vpandn).

§

Lanes16Word16

lanes16Word16(s) — pack the first 16 Word16/Ints of a Seq into a Lanes16Word16.

§

SeqOfLanes16

seqOfLanes16(v) — unpack a Lanes16Word16 into a Seq of 16 Int lanes.

§

Splat16Word16

splat16Word16(x) — broadcast a Word16/Int into all 16 lanes.

§

Mulhi16

mulhi16(a, b) — lane-wise SIGNED high-16 multiply (vpmulhw, the Montgomery mulhi).

§

Montmul32

montmul32(a, b, q, qinv) — the signed i32 Montgomery multiply over 8 lanes (vpmuldq), the ML-DSA (Dilithium) NTT butterfly multiply (q/qinv broadcast).

§

NttBcastLo

nttBcastLo(v, h) — broadcast each 2h-block’s low h lanes into both halves (the within-vector NTT source-low duplication; vperm2i128/vpshufd by stride).

§

NttBcastHi

nttBcastHi(v, h) — broadcast each 2h-block’s high h lanes into both halves.

§

NttBlend

nttBlend(a, b, h) — each 2h-block’s low h from a, high h from b (the butterfly half-recombine; vperm2i128/vpblendd by stride).

§

MapOf

mapOf(k1, v1, k2, v2, …) — construct a Map from flat key/value pairs in INSERTION order (the {k: v, …} literal’s lowering). A duplicate key keeps its first position with the last value, like repeated Set item k of m writes.

§

SetOf

setOf(a, b, …) — construct a Set from elements in insertion order, deduplicating by value equality (the {a, b, …} literal’s lowering).

§

RepeatSeq

repeatSeq(x, n) — a fresh sequence of n slots, each an INDEPENDENT deep copy of x (the n copies of x / [x] * n fill; a repeated inner collection is n rows, never n aliases). n ≤ 0 is empty.

Trait Implementations§

Source§

impl Clone for BuiltinId

Source§

fn clone(&self) -> BuiltinId

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BuiltinId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BuiltinId

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for BuiltinId

Source§

fn eq(&self, other: &BuiltinId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for BuiltinId

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for BuiltinId

Source§

impl Eq for BuiltinId

Source§

impl StructuralPartialEq for BuiltinId

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,