From 8d04bed34ca25b832cef1cd2c83d6fcbedd1d4a6 Mon Sep 17 00:00:00 2001 From: Byson94 Date: Sat, 30 Aug 2025 20:58:57 +0530 Subject: [PATCH] feat(ci): added module docs generation logic in workflow --- .github/workflows/gh-pages.yml | 50 +- docs/src/modules/apilib.md | 472 +-- docs/src/modules/global.md | 6683 +------------------------------- docs/src/modules/stdlib.md | 1040 +---- 4 files changed, 46 insertions(+), 8199 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 6c6eeda..6f88893 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,4 +1,5 @@ name: Build and deploy Github pages + on: push: branches: @@ -14,18 +15,53 @@ jobs: build: name: Build mdBook runs-on: ubuntu-latest - steps: - # Checkout - - uses: actions/checkout@master - # Build & deploy - - name: build mdBook page + steps: + # Checkout code + - name: Checkout repository + uses: actions/checkout@v2 + + # Cache Rust toolchain + - name: Cache Rust toolchain + uses: actions/cache@v2 + with: + path: ~/.cargo + key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-rust- + + # Install Rust + - name: Install Rust + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source $HOME/.cargo/env + + # Cache Cargo registry and git directory + - name: Cache Cargo registry and git + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + # Generate module docs + - name: Generate module docs + run: cargo run --release -p generate-rhai-docs + + # Build mdBook + - name: Build mdBook page uses: peaceiris/actions-mdbook@v1 with: mdbook-version: "0.4.52" - - run: mdbook build docs - - name: Deploy + - name: Run mdBook build + run: mdbook build docs + + # Deploy to GitHub Pages + - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/src/modules/apilib.md b/docs/src/modules/apilib.md index f0e02fd..1595b41 100644 --- a/docs/src/modules/apilib.md +++ b/docs/src/modules/apilib.md @@ -1,471 +1 @@ -# wifi - -```Namespace: global/api/wifi``` - -
-

fn connect

- -```rust,ignore -fn connect(ssid: String, password: String) -``` - -
-
- - - - -
- -
-Connects to a Wi-Fi network with the specified SSID and password. -
- - - - -
-
-
-
-

fn connect_without_password

- -```rust,ignore -fn connect_without_password(ssid: String) -``` - -
-
- - - - -
- -
-Connects to a Wi-Fi network with the specified SSID using saved profile (no password required). -
- - - - -
-
-
-
-

fn current_connection

- -```rust,ignore -fn current_connection() -> Map -``` - -
-
- - - - -
- -
-Retrieves the current active Wi-Fi connection's details (SSID, signal, and security). -
- - - - -
-
-
-
-

fn disable_adapter

- -```rust,ignore -fn disable_adapter() -``` - -
-
- - - - -
- -
-Disables the Wi-Fi adapter. -
- - - - -
-
-
-
-

fn disconnect

- -```rust,ignore -fn disconnect() -``` - -
-
- - - - -
- -
-Disconnects from the current Wi-Fi network. -
- - - - -
-
-
-
-

fn enable_adapter

- -```rust,ignore -fn enable_adapter() -``` - -
-
- - - - -
- -
-Enables the Wi-Fi adapter. -
- - - - -
-
-
-
-

fn get_adapter_connectivity

- -```rust,ignore -fn get_adapter_connectivity() -> String -``` - -
-
- - - - -
- -
-Get the currenet state of adapter. -
- - - - -
-
-
-
-

fn scan

- -```rust,ignore -fn scan() -> Array -``` - -
-
- - - - -
- -
-Scans for all available Wi-Fi connections, platform-dependent (Linux or macOS). -
- - - - -
-
-
-
-

fn scan_linux

- -```rust,ignore -fn scan_linux() -> Array -``` - -
-
- - - - -
- -
-Scans for all available Wi-Fi connections on Linux. -
- - - - -
-
-
+# API Library diff --git a/docs/src/modules/global.md b/docs/src/modules/global.md index ecb5bdf..6bb60d1 100644 --- a/docs/src/modules/global.md +++ b/docs/src/modules/global.md @@ -1,6682 +1 @@ -# global - -```Namespace: global``` - -
-

op !=

- -```rust,ignore -op Map != Map -> bool -op i32 != i32 -> bool -op u8 != u8 -> bool -op u128 != u128 -> bool -op i128 != i128 -> bool -op u64 != u64 -> bool -op Instant != Instant -> bool -op Array != Array -> bool -op int != f32 -> bool -op i8 != i8 -> bool -op u16 != u16 -> bool -op u32 != u32 -> bool -op f32 != f32 -> bool -op f32 != int -> bool -op i16 != i16 -> bool -``` - -
-
- - -
- -
-Return `true` if two object maps are not equal (i.e. at least one property value is not equal). - -The operator `==` is used to compare property values and must be defined, -otherwise `false` is assumed. -
- - -
-
-
-
-

fn +

- -```rust,ignore -fn +(x: f32) -> f32 -fn +(x: float) -> float -fn +(x: i16) -> i16 -fn +(x: int) -> int -fn +(x: i8) -> i8 -fn +(x: i128) -> i128 -fn +(x: i32) -> i32 -fn +(x: i16, y: i16) -> i16 -fn +(x: f32, y: f32) -> f32 -fn +(x: f32, y: int) -> f32 -fn +(timestamp: Instant, seconds: int) -> Instant -fn +(x: u32, y: u32) -> u32 -fn +(item: ?, string: String) -> String -fn +(character: char, string: String) -> String -fn +(x: u16, y: u16) -> u16 -fn +(string: String, character: char) -> String -fn +(utf8: Blob, string: String) -> String -fn +(timestamp: Instant, seconds: float) -> Instant -fn +(x: i8, y: i8) -> i8 -fn +(array1: Array, array2: Array) -> Array -fn +(x: int, y: f32) -> f32 -fn +(item: ?, string: String) -> String -fn +(x: u64, y: u64) -> u64 -fn +(string: String, item: ?) -> String -fn +(string: String, mut item: ?) -> String -fn +(x: u128, y: u128) -> u128 -fn +(x: i128, y: i128) -> i128 -fn +(x: u8, y: u8) -> u8 -fn +(map1: Map, map2: Map) -> Map -fn +(x: i32, y: i32) -> i32 -fn +(string: String, utf8: Blob) -> String -fn +(string1: String, string2: String) -> String -``` - -
-
- -
- -
-Add the specified number of `seconds` to the timestamp and return it as a new timestamp. -
- -
-
-
-
-

fn +=

- -```rust,ignore -fn +=(map: Map, map2: Map) -fn +=(string1: String, string2: String) -fn +=(string: String, utf8: Blob) -fn +=(string: String, item: ?) -fn +=(string: String, mut item: ?) -fn +=(string: String, character: char) -fn +=(timestamp: Instant, seconds: float) -fn +=(timestamp: Instant, seconds: int) -``` - -
-
- - -
- -
-Add all property values of another object map into the object map. -Existing property values of the same names are replaced. -
- - -
-
-
-
-

fn -

- -```rust,ignore -fn -(x: i16) -> i16 -fn -(x: float) -> float -fn -(x: f32) -> f32 -fn -(x: i32) -> i32 -fn -(x: i128) -> i128 -fn -(x: i8) -> i8 -fn -(x: int) -> int -fn -(x: u32, y: u32) -> u32 -fn -(x: u16, y: u16) -> u16 -fn -(timestamp: Instant, seconds: float) -> Instant -fn -(x: i8, y: i8) -> i8 -fn -(x: i16, y: i16) -> i16 -fn -(timestamp: Instant, seconds: int) -> Instant -fn -(x: f32, y: f32) -> f32 -fn -(x: f32, y: int) -> f32 -fn -(x: i128, y: i128) -> i128 -fn -(x: u128, y: u128) -> u128 -fn -(x: u8, y: u8) -> u8 -fn -(x: i32, y: i32) -> i32 -fn -(x: int, y: f32) -> f32 -fn -(timestamp1: Instant, timestamp2: Instant) -> ? -fn -(x: u64, y: u64) -> u64 -``` - -
-
- -
- -
-Subtract the specified number of `seconds` from the timestamp and return it as a new timestamp. -
- -
-
-
-
-

fn -=

- -```rust,ignore -fn -=(timestamp: Instant, seconds: int) -fn -=(timestamp: Instant, seconds: float) -``` - -
-
- -
- -
-Subtract the specified number of `seconds` from the timestamp. -
- -
-
-
-
-

op <

- -```rust,ignore -op u128 < u128 -> bool -op i128 < i128 -> bool -op u8 < u8 -> bool -op i32 < i32 -> bool -op int < f32 -> bool -op Instant < Instant -> bool -op u64 < u64 -> bool -op u32 < u32 -> bool -op u16 < u16 -> bool -op i8 < i8 -> bool -op i16 < i16 -> bool -op f32 < f32 -> bool -op f32 < int -> bool -``` - -
-
- -
- -
-Return `true` if the first timestamp is earlier than the second. -
- -
-
-
-
-

op <=

- -```rust,ignore -op u16 <= u16 -> bool -op i8 <= i8 -> bool -op u32 <= u32 -> bool -op f32 <= int -> bool -op f32 <= f32 -> bool -op i16 <= i16 -> bool -op i32 <= i32 -> bool -op u128 <= u128 -> bool -op i128 <= i128 -> bool -op u8 <= u8 -> bool -op u64 <= u64 -> bool -op int <= f32 -> bool -op Instant <= Instant -> bool -``` - -
-
- -
- -
-Return `true` if the first timestamp is earlier than or equals to the second. -
- -
-
-
-
-

op ==

- -```rust,ignore -op i128 == i128 -> bool -op u128 == u128 -> bool -op u8 == u8 -> bool -op i32 == i32 -> bool -op Map == Map -> bool -op int == f32 -> bool -op Array == Array -> bool -op Instant == Instant -> bool -op u64 == u64 -> bool -op u32 == u32 -> bool -op u16 == u16 -> bool -op i8 == i8 -> bool -op i16 == i16 -> bool -op f32 == int -> bool -op f32 == f32 -> bool -``` - -
-
- - -
- -
-Return `true` if two object maps are equal (i.e. all property values are equal). - -The operator `==` is used to compare property values and must be defined, -otherwise `false` is assumed. -
- - -
-
-
-
-

op >

- -```rust,ignore -op i128 > i128 -> bool -op u128 > u128 -> bool -op u8 > u8 -> bool -op i32 > i32 -> bool -op int > f32 -> bool -op Instant > Instant -> bool -op u64 > u64 -> bool -op u32 > u32 -> bool -op u16 > u16 -> bool -op i8 > i8 -> bool -op i16 > i16 -> bool -op f32 > int -> bool -op f32 > f32 -> bool -``` - -
-
- -
- -
-Return `true` if the first timestamp is later than the second. -
- -
-
-
-
-

op >=

- -```rust,ignore -op f32 >= int -> bool -op f32 >= f32 -> bool -op i16 >= i16 -> bool -op u16 >= u16 -> bool -op i8 >= i8 -> bool -op u32 >= u32 -> bool -op u64 >= u64 -> bool -op int >= f32 -> bool -op Instant >= Instant -> bool -op i32 >= i32 -> bool -op u128 >= u128 -> bool -op i128 >= i128 -> bool -op u8 >= u8 -> bool -``` - -
-
- -
- -
-Return `true` if the first timestamp is later than or equals to the second. -
- -
-
-
-
-

get/set ?.tag

- -```rust,ignore -get ?.tag -> int -set ?.tag = int -``` - -
-
- - -
- -
-Return the _tag_ of a `Dynamic` value. -
- - -
-
-
-
-

get/set Array.is_empty

- -```rust,ignore -get Array.is_empty -> bool -``` - -
-
- -
- -
-Return true if the array is empty. -
- -
-
-
-
-

get/set Array.len

- -```rust,ignore -get Array.len -> int -``` - -
-
- -
- -
-Number of elements in the array. -
- -
-
-
-
-

get/set Blob.is_empty

- -```rust,ignore -get Blob.is_empty -> bool -``` - -
-
- -
- -
-Return true if the BLOB is empty. -
- -
-
-
-
-

get/set Blob.len

- -```rust,ignore -get Blob.len -> int -``` - -
-
- - -
- -
-Return the length of the BLOB. -
- - -
-
-
-
-

fn E

- -```rust,ignore -fn E() -> float -``` - -
-
- -
- -
-Return the natural number _e_. -
- -
-
-
-
-

get/set FnPtr.is_anonymous

- -```rust,ignore -get FnPtr.is_anonymous -> bool -``` - -
-
- - -
- -
-Return `true` if the function is an anonymous function. -
- - -
-
-
-
-

get/set FnPtr.name

- -```rust,ignore -get FnPtr.name -> String -``` - -
-
- - -
- -
-Return the name of the function. -
- - -
-
-
-
-

get/set Instant.elapsed

- -```rust,ignore -get Instant.elapsed -> ? -``` - -
-
- - -
- -
-Return the number of seconds between the current system time and the timestamp. -
- - -
-
-
-
-

fn PI

- -```rust,ignore -fn PI() -> float -``` - -
-
- -
- -
-Return the number π. -
- -
-
-
-
-

get/set Range<int>.end

- -```rust,ignore -get Range.end -> int -``` - -
-
- -
- -
-Return the end of the exclusive range. -
- -
-
-
-
-

get/set Range<int>.is_empty

- -```rust,ignore -get Range.is_empty -> bool -``` - -
-
- -
- -
-Return true if the range contains no items. -
- -
-
-
-
-

get/set Range<int>.is_exclusive

- -```rust,ignore -get Range.is_exclusive -> bool -``` - -
-
- -
- -
-Return `true` if the range is exclusive. -
- -
-
-
-
-

get/set Range<int>.is_inclusive

- -```rust,ignore -get Range.is_inclusive -> bool -``` - -
-
- -
- -
-Return `true` if the range is inclusive. -
- -
-
-
-
-

get/set Range<int>.start

- -```rust,ignore -get Range.start -> int -``` - -
-
- -
- -
-Return the start of the exclusive range. -
- -
-
-
-
-

get/set RangeInclusive<int>.end

- -```rust,ignore -get RangeInclusive.end -> int -``` - -
-
- -
- -
-Return the end of the inclusive range. -
- -
-
-
-
-

get/set RangeInclusive<int>.is_empty

- -```rust,ignore -get RangeInclusive.is_empty -> bool -``` - -
-
- -
- -
-Return true if the range contains no items. -
- -
-
-
-
-

get/set RangeInclusive<int>.is_exclusive

- -```rust,ignore -get RangeInclusive.is_exclusive -> bool -``` - -
-
- -
- -
-Return `true` if the range is exclusive. -
- -
-
-
-
-

get/set RangeInclusive<int>.is_inclusive

- -```rust,ignore -get RangeInclusive.is_inclusive -> bool -``` - -
-
- -
- -
-Return `true` if the range is inclusive. -
- -
-
-
-
-

get/set RangeInclusive<int>.start

- -```rust,ignore -get RangeInclusive.start -> int -``` - -
-
- -
- -
-Return the start of the inclusive range. -
- -
-
-
-
-

get/set String.bytes

- -```rust,ignore -get String.bytes -> int -``` - -
-
- - -
- -
-Return the length of the string, in number of bytes used to store it in UTF-8 encoding. -
- - -
-
-
-
-

get/set String.chars

- -```rust,ignore -get String.chars -> CharsStream -``` - -
-
- - -
- -
-Return an iterator over all the characters in the string. -
- - -
-
-
-
-

get/set String.is_empty

- -```rust,ignore -get String.is_empty -> bool -``` - -
-
- -
- -
-Return true if the string is empty. -
- -
-
-
-
-

get/set String.len

- -```rust,ignore -get String.len -> int -``` - -
-
- - -
- -
-Return the length of the string, in number of characters. -
- - -
-
-
-
-

fn abs

- -```rust,ignore -fn abs(x: f32) -> f32 -fn abs(x: i16) -> i16 -fn abs(x: float) -> float -fn abs(x: i128) -> i128 -fn abs(x: i32) -> i32 -fn abs(x: int) -> int -fn abs(x: i8) -> i8 -``` - -
-
- -
- -
-Return the absolute value of the floating-point number. -
- -
-
-
-
-

fn acos

- -```rust,ignore -fn acos(x: float) -> float -``` - -
-
- -
- -
-Return the arc-cosine of the floating-point number, in radians. -
- -
-
-
-
-

fn acosh

- -```rust,ignore -fn acosh(x: float) -> float -``` - -
-
- -
- -
-Return the arc-hyperbolic-cosine of the floating-point number, in radians. -
- -
-
-
-
-

fn all

- -```rust,ignore -fn all(array: Array, filter: String) -> bool -fn all(array: Array, filter: FnPtr) -> bool -``` - -
-
- - - - -
- -
-Return `true` if all elements in the array return `true` when applied a function named by `filter`. -
- - - - -
-
-
-
-

fn append

- -```rust,ignore -fn append(blob1: Blob, blob2: Blob) -fn append(string: String, utf8: Blob) -fn append(array: Array, new_array: Array) -fn append(string: String, mut item: ?) -fn append(blob: Blob, value: int) -fn append(blob: Blob, string: String) -fn append(blob: Blob, character: char) -``` - -
-
- - -
- -
-Add another BLOB to the end of the BLOB. -
- - -
-
-
-
-

fn as_string

- -```rust,ignore -fn as_string(blob: Blob) -> String -``` - -
-
- - -
- -
-Convert the BLOB into a string. - -The byte stream must be valid UTF-8, otherwise an error is raised. -
- - -
-
-
-
-

fn asin

- -```rust,ignore -fn asin(x: float) -> float -``` - -
-
- -
- -
-Return the arc-sine of the floating-point number, in radians. -
- -
-
-
-
-

fn asinh

- -```rust,ignore -fn asinh(x: float) -> float -``` - -
-
- -
- -
-Return the arc-hyperbolic-sine of the floating-point number, in radians. -
- -
-
-
-
-

fn atan

- -```rust,ignore -fn atan(x: float) -> float -fn atan(x: float, y: float) -> float -``` - -
-
- -
- -
-Return the arc-tangent of the floating-point number, in radians. -
- -
-
-
-
-

fn atanh

- -```rust,ignore -fn atanh(x: float) -> float -``` - -
-
- -
- -
-Return the arc-hyperbolic-tangent of the floating-point number, in radians. -
- -
-
-
-
-

fn bits

- -```rust,ignore -fn bits(value: int) -> BitRange -fn bits(value: int, range: Range) -> BitRange -fn bits(value: int, from: int) -> BitRange -fn bits(value: int, range: RangeInclusive) -> BitRange -fn bits(value: int, from: int, len: int) -> BitRange -``` - -
-
- - -
- -
-Return an iterator over all the bits in the number. -
- - -
-
-
-
-

fn blob

- -```rust,ignore -fn blob() -> Blob -fn blob(len: int) -> Blob -fn blob(len: int, value: int) -> Blob -``` - -
-
- -
- -
-Return a new, empty BLOB. -
- -
-
-
-
-

fn bytes

- -```rust,ignore -fn bytes(string: String) -> int -``` - -
-
- - -
- -
-Return the length of the string, in number of bytes used to store it in UTF-8 encoding. -
- - -
-
-
-
-

fn ceiling

- -```rust,ignore -fn ceiling(x: float) -> float -``` - -
-
- -
- -
-Return the smallest whole number larger than or equals to the floating-point number. -
- -
-
-
-
-

fn chars

- -```rust,ignore -fn chars(string: String) -> CharsStream -fn chars(string: String, start: int) -> CharsStream -fn chars(string: String, range: RangeInclusive) -> CharsStream -fn chars(string: String, range: Range) -> CharsStream -fn chars(string: String, start: int, len: int) -> CharsStream -``` - -
-
- - -
- -
-Return an iterator over the characters in the string. -
- - -
-
-
-
-

fn chop

- -```rust,ignore -fn chop(array: Array, len: int) -fn chop(blob: Blob, len: int) -``` - -
-
- - -
- -
-Cut off the head of the array, leaving a tail of the specified length. - -* If `len` ≤ 0, the array is cleared. -* If `len` ≥ length of array, the array is not modified. -
- - -
-
-
-
-

fn clear

- -```rust,ignore -fn clear(map: Map) -fn clear(array: Array) -fn clear(blob: Blob) -fn clear(string: String) -``` - -
-
- -
- -
-Clear the object map. -
- -
-
-
-
-

fn contains

- -```rust,ignore -fn contains(blob: Blob, value: int) -> bool -fn contains(range: Range, value: int) -> bool -fn contains(string: String, character: char) -> bool -fn contains(array: Array, value: ?) -> bool -fn contains(range: RangeInclusive, value: int) -> bool -fn contains(string: String, match_string: String) -> bool -fn contains(map: Map, property: String) -> bool -``` - -
-
- - -
- -
-Return `true` if the BLOB contains a specified byte value. -
- - -
-
-
-
-

fn cos

- -```rust,ignore -fn cos(x: float) -> float -``` - -
-
- -
- -
-Return the cosine of the floating-point number in radians. -
- -
-
-
-
-

fn cosh

- -```rust,ignore -fn cosh(x: float) -> float -``` - -
-
- -
- -
-Return the hyperbolic cosine of the floating-point number in radians. -
- -
-
-
-
-

fn crop

- -```rust,ignore -fn crop(string: String, start: int) -fn crop(string: String, range: RangeInclusive) -fn crop(string: String, range: Range) -fn crop(string: String, start: int, len: int) -``` - -
-
- - -
- -
-Remove all characters from the string up to the `start` position. - -* If `start` < 0, position counts from the end of the string (`-1` is the last character). -* If `start` < -length of string, the string is not modified. -* If `start` ≥ length of string, the entire string is cleared. -
- - -
-
-
-
-

fn debug

- -```rust,ignore -fn debug() -> String -fn debug(value: bool) -> String -fn debug(f: FnPtr) -> String -fn debug(character: char) -> String -fn debug(array: Array) -> String -fn debug(unit: ?) -> String -fn debug(string: String) -> String -fn debug(item: ?) -> String -fn debug(map: Map) -> String -fn debug(number: f32) -> String -fn debug(number: float) -> String -``` - -
-
- -
- -
-Return the empty string. -
- -
-
-
-
-

fn dedup

- -```rust,ignore -fn dedup(array: Array) -fn dedup(array: Array, comparer: String) -fn dedup(array: Array, comparer: FnPtr) -``` - -
-
- - -
- -
-Remove duplicated _consecutive_ elements from the array. - -The operator `==` is used to compare elements and must be defined, -otherwise `false` is assumed. -
- - -
-
-
-
-

fn drain

- -```rust,ignore -fn drain(array: Array, range: Range) -> Array -fn drain(blob: Blob, range: RangeInclusive) -> Blob -fn drain(array: Array, filter: FnPtr) -> Array -fn drain(blob: Blob, range: Range) -> Blob -fn drain(array: Array, range: RangeInclusive) -> Array -fn drain(map: Map, filter: FnPtr) -> Map -fn drain(array: Array, filter: String) -> Array -fn drain(array: Array, start: int, len: int) -> Array -fn drain(blob: Blob, start: int, len: int) -> Blob -``` - -
-
- - -
- -
-Remove all elements in the array within an exclusive `range` and return them as a new array. -
- - -
-
-
-
-

fn elapsed

- -```rust,ignore -fn elapsed(timestamp: Instant) -> ? -``` - -
-
- - -
- -
-Return the number of seconds between the current system time and the timestamp. -
- - -
-
-
-
-

fn end

- -```rust,ignore -fn end(range: RangeInclusive) -> int -fn end(range: Range) -> int -``` - -
-
- -
- -
-Return the end of the inclusive range. -
- -
-
-
-
-

fn ends_with

- -```rust,ignore -fn ends_with(string: String, match_string: String) -> bool -``` - -
-
- - -
- -
-Return `true` if the string ends with a specified string. -
- - -
-
-
-
-

fn exit

- -```rust,ignore -fn exit() -> ? -fn exit(value: ?) -> ? -``` - -
-
- - -
- -
-Exit the script evaluation immediately with `()` as exit value. -
- - -
-
-
-
-

fn exp

- -```rust,ignore -fn exp(x: float) -> float -``` - -
-
- -
- -
-Return the exponential of the floating-point number. -
- -
-
-
-
-

fn extract

- -```rust,ignore -fn extract(array: Array, range: RangeInclusive) -> Array -fn extract(blob: Blob, range: Range) -> Blob -fn extract(array: Array, range: Range) -> Array -fn extract(array: Array, start: int) -> Array -fn extract(blob: Blob, start: int) -> Blob -fn extract(blob: Blob, range: RangeInclusive) -> Blob -fn extract(array: Array, start: int, len: int) -> Array -fn extract(blob: Blob, start: int, len: int) -> Blob -``` - -
-
- - -
- -
-Copy an inclusive range of the array and return it as a new array. -
- - -
-
-
-
-

get/set f32.is_zero

- -```rust,ignore -get f32.is_zero -> bool -``` - -
-
- -
- -
-Return true if the floating-point number is zero. -
- -
-
-
-
-

fn fill_with

- -```rust,ignore -fn fill_with(map: Map, map2: Map) -``` - -
-
- - -
- -
-Add all property values of another object map into the object map. -Only properties that do not originally exist in the object map are added. -
- - -
-
-
-
-

fn filter

- -```rust,ignore -fn filter(array: Array, filter: FnPtr) -> Array -fn filter(map: Map, filter: FnPtr) -> Map -fn filter(array: Array, filter_func: String) -> Array -``` - -
-
- - - - -
- -
-Iterate through all the elements in the array, applying a `filter` function to each element -in turn, and return a copy of all elements (in order) that return `true` as a new array. -
- - - - -
-
-
-
-

fn find

- -```rust,ignore -fn find(array: Array, filter: FnPtr) -> ? -fn find(array: Array, filter: FnPtr, start: int) -> ? -``` - -
-
- - - - -
- -
-Iterate through all the elements in the array, applying a `filter` function to each element -in turn, and return a copy of the first element that returns `true`. If no element returns -`true`, `()` is returned. -
- - - - -
-
-
-
-

fn find_map

- -```rust,ignore -fn find_map(array: Array, filter: FnPtr) -> ? -fn find_map(array: Array, filter: FnPtr, start: int) -> ? -``` - -
-
- - - - -
- -
-Iterate through all the elements in the array, applying a `mapper` function to each element -in turn, and return the first result that is not `()`. Otherwise, `()` is returned. -
- - - - -
-
-
-
-

get/set float.ceiling

- -```rust,ignore -get float.ceiling -> float -``` - -
-
- -
- -
-Return the smallest whole number larger than or equals to the floating-point number. -
- -
-
-
-
-

get/set float.floor

- -```rust,ignore -get float.floor -> float -``` - -
-
- -
- -
-Return the largest whole number less than or equals to the floating-point number. -
- -
-
-
-
-

get/set float.fraction

- -```rust,ignore -get float.fraction -> float -``` - -
-
- -
- -
-Return the fractional part of the floating-point number. -
- -
-
-
-
-

get/set float.int

- -```rust,ignore -get float.int -> float -``` - -
-
- -
- -
-Return the integral part of the floating-point number. -
- -
-
-
-
-

get/set float.is_finite

- -```rust,ignore -get float.is_finite -> bool -``` - -
-
- -
- -
-Return `true` if the floating-point number is finite. -
- -
-
-
-
-

get/set float.is_infinite

- -```rust,ignore -get float.is_infinite -> bool -``` - -
-
- -
- -
-Return `true` if the floating-point number is infinite. -
- -
-
-
-
-

get/set float.is_nan

- -```rust,ignore -get float.is_nan -> bool -``` - -
-
- -
- -
-Return `true` if the floating-point number is `NaN` (Not A Number). -
- -
-
-
-
-

get/set float.is_zero

- -```rust,ignore -get float.is_zero -> bool -``` - -
-
- -
- -
-Return true if the floating-point number is zero. -
- -
-
-
-
-

get/set float.round

- -```rust,ignore -get float.round -> float -``` - -
-
- -
- -
-Return the nearest whole number closest to the floating-point number. -Rounds away from zero. -
- -
-
-
-
-

fn floor

- -```rust,ignore -fn floor(x: float) -> float -``` - -
-
- -
- -
-Return the largest whole number less than or equals to the floating-point number. -
- -
-
-
-
-

fn for_each

- -```rust,ignore -fn for_each(array: Array, map: FnPtr) -``` - -
-
- - - -
- -
-Iterate through all the elements in the array, applying a `process` function to each element in turn. -Each element is bound to `this` before calling the function. -
- - - -
-
-
-
-

fn fraction

- -```rust,ignore -fn fraction(x: float) -> float -``` - -
-
- -
- -
-Return the fractional part of the floating-point number. -
- -
-
-
-
-

fn get

- -```rust,ignore -fn get(blob: Blob, index: int) -> int -fn get(array: Array, index: int) -> ? -fn get(string: String, index: int) -> ? -fn get(map: Map, property: String) -> ? -``` - -
-
- - -
- -
-Get the byte value at the `index` position in the BLOB. - -* If `index` < 0, position counts from the end of the BLOB (`-1` is the last element). -* If `index` < -length of BLOB, zero is returned. -* If `index` ≥ length of BLOB, zero is returned. -
- - -
-
-
-
-

fn get_bit

- -```rust,ignore -fn get_bit(value: int, bit: int) -> bool -``` - -
-
- - -
- -
-Return `true` if the specified `bit` in the number is set. - -If `bit` < 0, position counts from the MSB (Most Significant Bit). -
- - -
-
-
-
-

fn get_bits

- -```rust,ignore -fn get_bits(value: int, range: RangeInclusive) -> int -fn get_bits(value: int, range: Range) -> int -fn get_bits(value: int, start: int, bits: int) -> int -``` - -
-
- - -
- -
-Return an inclusive range of bits in the number as a new number. -
- - -
-
-
-
-

fn get_fn_metadata_list

- -```rust,ignore -fn get_fn_metadata_list() -> Array -fn get_fn_metadata_list(name: String) -> Array -fn get_fn_metadata_list(name: String, params: int) -> Array -``` - -
-
- -
- -
-Return an array of object maps containing metadata of all script-defined functions. -
- -
-
-
-
-

fn hypot

- -```rust,ignore -fn hypot(x: float, y: float) -> float -``` - -
-
- -
- -
-Return the hypotenuse of a triangle with sides `x` and `y`. -
- -
-
-
-
-

get/set i128.is_even

- -```rust,ignore -get i128.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set i128.is_odd

- -```rust,ignore -get i128.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set i128.is_zero

- -```rust,ignore -get i128.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

get/set i16.is_even

- -```rust,ignore -get i16.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set i16.is_odd

- -```rust,ignore -get i16.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set i16.is_zero

- -```rust,ignore -get i16.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

get/set i32.is_even

- -```rust,ignore -get i32.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set i32.is_odd

- -```rust,ignore -get i32.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set i32.is_zero

- -```rust,ignore -get i32.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

get/set i8.is_even

- -```rust,ignore -get i8.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set i8.is_odd

- -```rust,ignore -get i8.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set i8.is_zero

- -```rust,ignore -get i8.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

fn index_of

- -```rust,ignore -fn index_of(array: Array, value: ?) -> int -fn index_of(string: String, character: char) -> int -fn index_of(array: Array, filter: FnPtr) -> int -fn index_of(string: String, find_string: String) -> int -fn index_of(array: Array, filter: String) -> int -fn index_of(array: Array, filter: String, start: int) -> int -fn index_of(string: String, find_string: String, start: int) -> int -fn index_of(string: String, character: char, start: int) -> int -fn index_of(array: Array, value: ?, start: int) -> int -fn index_of(array: Array, filter: FnPtr, start: int) -> int -``` - -
-
- - -
- -
-Find the first element in the array that equals a particular `value` and return its index. -If no element equals `value`, `-1` is returned. - -The operator `==` is used to compare elements with `value` and must be defined, -otherwise `false` is assumed. -
- - -
-
-
-
-

fn insert

- -```rust,ignore -fn insert(array: Array, index: int, item: ?) -fn insert(blob: Blob, index: int, value: int) -``` - -
-
- - -
- -
-Add a new element into the array at a particular `index` position. - -* If `index` < 0, position counts from the end of the array (`-1` is the last element). -* If `index` < -length of array, the element is added to the beginning of the array. -* If `index` ≥ length of array, the element is appended to the end of the array. -
- - -
-
-
-
-

fn int

- -```rust,ignore -fn int(x: float) -> float -``` - -
-
- -
- -
-Return the integral part of the floating-point number. -
- -
-
-
-
-

get/set int.bits

- -```rust,ignore -get int.bits -> BitRange -``` - -
-
- - -
- -
-Return an iterator over all the bits in the number. -
- - -
-
-
-
-

get/set int.is_even

- -```rust,ignore -get int.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set int.is_odd

- -```rust,ignore -get int.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set int.is_zero

- -```rust,ignore -get int.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

fn is_anonymous

- -```rust,ignore -fn is_anonymous(fn_ptr: FnPtr) -> bool -``` - -
-
- - -
- -
-Return `true` if the function is an anonymous function. -
- - -
-
-
-
-

fn is_empty

- -```rust,ignore -fn is_empty(map: Map) -> bool -fn is_empty(range: Range) -> bool -fn is_empty(string: String) -> bool -fn is_empty(blob: Blob) -> bool -fn is_empty(array: Array) -> bool -fn is_empty(range: RangeInclusive) -> bool -``` - -
-
- -
- -
-Return true if the map is empty. -
- -
-
-
-
-

fn is_even

- -```rust,ignore -fn is_even(x: i8) -> bool -fn is_even(x: int) -> bool -fn is_even(x: u8) -> bool -fn is_even(x: u16) -> bool -fn is_even(x: i32) -> bool -fn is_even(x: i128) -> bool -fn is_even(x: u64) -> bool -fn is_even(x: u128) -> bool -fn is_even(x: i16) -> bool -fn is_even(x: u32) -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

fn is_exclusive

- -```rust,ignore -fn is_exclusive(range: RangeInclusive) -> bool -fn is_exclusive(range: Range) -> bool -``` - -
-
- -
- -
-Return `true` if the range is exclusive. -
- -
-
-
-
-

fn is_finite

- -```rust,ignore -fn is_finite(x: float) -> bool -``` - -
-
- -
- -
-Return `true` if the floating-point number is finite. -
- -
-
-
-
-

fn is_inclusive

- -```rust,ignore -fn is_inclusive(range: Range) -> bool -fn is_inclusive(range: RangeInclusive) -> bool -``` - -
-
- -
- -
-Return `true` if the range is inclusive. -
- -
-
-
-
-

fn is_infinite

- -```rust,ignore -fn is_infinite(x: float) -> bool -``` - -
-
- -
- -
-Return `true` if the floating-point number is infinite. -
- -
-
-
-
-

fn is_nan

- -```rust,ignore -fn is_nan(x: float) -> bool -``` - -
-
- -
- -
-Return `true` if the floating-point number is `NaN` (Not A Number). -
- -
-
-
-
-

fn is_odd

- -```rust,ignore -fn is_odd(x: int) -> bool -fn is_odd(x: i8) -> bool -fn is_odd(x: u64) -> bool -fn is_odd(x: i128) -> bool -fn is_odd(x: i32) -> bool -fn is_odd(x: u8) -> bool -fn is_odd(x: u16) -> bool -fn is_odd(x: i16) -> bool -fn is_odd(x: u128) -> bool -fn is_odd(x: u32) -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

fn is_zero

- -```rust,ignore -fn is_zero(x: i8) -> bool -fn is_zero(x: int) -> bool -fn is_zero(x: u8) -> bool -fn is_zero(x: u16) -> bool -fn is_zero(x: i32) -> bool -fn is_zero(x: i128) -> bool -fn is_zero(x: u64) -> bool -fn is_zero(x: u128) -> bool -fn is_zero(x: i16) -> bool -fn is_zero(x: float) -> bool -fn is_zero(x: f32) -> bool -fn is_zero(x: u32) -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

fn keys

- -```rust,ignore -fn keys(map: Map) -> Array -``` - -
-
- - -
- -
-Return an array with all the property names in the object map. -
- - -
-
-
-
-

fn len

- -```rust,ignore -fn len(array: Array) -> int -fn len(blob: Blob) -> int -fn len(string: String) -> int -fn len(map: Map) -> int -``` - -
-
- -
- -
-Number of elements in the array. -
- -
-
-
-
-

fn ln

- -```rust,ignore -fn ln(x: float) -> float -``` - -
-
- -
- -
-Return the natural log of the floating-point number. -
- -
-
-
-
-

fn log

- -```rust,ignore -fn log(x: float) -> float -fn log(x: float, base: float) -> float -``` - -
-
- -
- -
-Return the log of the floating-point number with base 10. -
- -
-
-
-
-

fn make_lower

- -```rust,ignore -fn make_lower(string: String) -fn make_lower(character: char) -``` - -
-
- - -
- -
-Convert the string to all lower-case. -
- - -
-
-
-
-

fn make_upper

- -```rust,ignore -fn make_upper(string: String) -fn make_upper(character: char) -``` - -
-
- - -
- -
-Convert the string to all upper-case. -
- - -
-
-
-
-

fn map

- -```rust,ignore -fn map(array: Array, mapper: String) -> Array -fn map(array: Array, map: FnPtr) -> Array -``` - -
-
- - - - -
- -
-Iterate through all the elements in the array, applying a function named by `mapper` to each -element in turn, and return the results as a new array. -
- - - - -
-
-
-
-

fn max

- -```rust,ignore -fn max(x: u32, y: u32) -> u32 -fn max(x: int, y: int) -> int -fn max(x: i8, y: i8) -> i8 -fn max(x: u16, y: u16) -> u16 -fn max(x: i16, y: i16) -> i16 -fn max(x: int, y: float) -> float -fn max(x: float, y: int) -> float -fn max(x: f32, y: float) -> float -fn max(x: f32, y: f32) -> f32 -fn max(x: f32, y: int) -> f32 -fn max(x: u8, y: u8) -> u8 -fn max(x: i128, y: i128) -> i128 -fn max(x: float, y: f32) -> float -fn max(x: u128, y: u128) -> u128 -fn max(string1: String, string2: String) -> String -fn max(x: i32, y: i32) -> i32 -fn max(x: int, y: f32) -> f32 -fn max(x: float, y: float) -> float -fn max(char1: char, char2: char) -> char -fn max(x: u64, y: u64) -> u64 -``` - -
-
- - -
- -
-Return the number that is larger than the other number. -
- - -
-
-
-
-

fn min

- -```rust,ignore -fn min(x: int, y: int) -> int -fn min(x: u32, y: u32) -> u32 -fn min(x: u16, y: u16) -> u16 -fn min(x: i8, y: i8) -> i8 -fn min(x: float, y: int) -> float -fn min(x: f32, y: float) -> float -fn min(x: int, y: float) -> float -fn min(x: i16, y: i16) -> i16 -fn min(x: f32, y: int) -> f32 -fn min(x: f32, y: f32) -> f32 -fn min(x: i128, y: i128) -> i128 -fn min(x: float, y: f32) -> float -fn min(x: u128, y: u128) -> u128 -fn min(x: u8, y: u8) -> u8 -fn min(x: i32, y: i32) -> i32 -fn min(string1: String, string2: String) -> String -fn min(x: int, y: f32) -> f32 -fn min(char1: char, char2: char) -> char -fn min(x: u64, y: u64) -> u64 -fn min(x: float, y: float) -> float -``` - -
-
- - -
- -
-Return the number that is smaller than the other number. -
- - -
-
-
-
-

fn mixin

- -```rust,ignore -fn mixin(map: Map, map2: Map) -``` - -
-
- - -
- -
-Add all property values of another object map into the object map. -Existing property values of the same names are replaced. -
- - -
-
-
-
-

fn name

- -```rust,ignore -fn name(fn_ptr: FnPtr) -> String -``` - -
-
- - -
- -
-Return the name of the function. -
- - -
-
-
-
-

fn pad

- -```rust,ignore -fn pad(string: String, len: int, character: char) -fn pad(array: Array, len: int, item: ?) -fn pad(blob: Blob, len: int, value: int) -fn pad(string: String, len: int, padding: String) -``` - -
-
- - -
- -
-Pad the string to at least the specified number of characters with the specified `character`. - -If `len` ≤ length of string, no padding is done. -
- - -
-
-
-
-

fn parse_be_float

- -```rust,ignore -fn parse_be_float(blob: Blob, range: Range) -> float -fn parse_be_float(blob: Blob, range: RangeInclusive) -> float -fn parse_be_float(blob: Blob, start: int, len: int) -> float -``` - -
-
- -
- -
-Parse the bytes within an exclusive `range` in the BLOB as a `FLOAT` -in big-endian byte order. - -* If number of bytes in `range` < number of bytes for `FLOAT`, zeros are padded. -* If number of bytes in `range` > number of bytes for `FLOAT`, extra bytes are ignored. -
- -
-
-
-
-

fn parse_be_int

- -```rust,ignore -fn parse_be_int(blob: Blob, range: RangeInclusive) -> int -fn parse_be_int(blob: Blob, range: Range) -> int -fn parse_be_int(blob: Blob, start: int, len: int) -> int -``` - -
-
- -
- -
-Parse the bytes within an inclusive `range` in the BLOB as an `INT` -in big-endian byte order. - -* If number of bytes in `range` < number of bytes for `INT`, zeros are padded. -* If number of bytes in `range` > number of bytes for `INT`, extra bytes are ignored. - -```rhai -let b = blob(); - -b += 1; b += 2; b += 3; b += 4; b += 5; - -let x = b.parse_be_int(1..=3); // parse three bytes - -print(x.to_hex()); // prints "0203040000...00" -``` -
- -
-
-
-
-

fn parse_float

- -```rust,ignore -fn parse_float(string: String) -> float -``` - -
-
- - -
- -
-Parse a string into a floating-point number. -
- - -
-
-
-
-

fn parse_int

- -```rust,ignore -fn parse_int(string: String) -> int -fn parse_int(string: String, radix: int) -> int -``` - -
-
- - -
- -
-Parse a string into an integer number. -
- - -
-
-
-
-

fn parse_json

- -```rust,ignore -fn parse_json(json: String) -> ? -``` - -
-
- - -
- -
-Parse a JSON string into a value. -
- - -
-
-
-
-

fn parse_le_float

- -```rust,ignore -fn parse_le_float(blob: Blob, range: Range) -> float -fn parse_le_float(blob: Blob, range: RangeInclusive) -> float -fn parse_le_float(blob: Blob, start: int, len: int) -> float -``` - -
-
- -
- -
-Parse the bytes within an exclusive `range` in the BLOB as a `FLOAT` -in little-endian byte order. - -* If number of bytes in `range` < number of bytes for `FLOAT`, zeros are padded. -* If number of bytes in `range` > number of bytes for `FLOAT`, extra bytes are ignored. -
- -
-
-
-
-

fn parse_le_int

- -```rust,ignore -fn parse_le_int(blob: Blob, range: RangeInclusive) -> int -fn parse_le_int(blob: Blob, range: Range) -> int -fn parse_le_int(blob: Blob, start: int, len: int) -> int -``` - -
-
- -
- -
-Parse the bytes within an inclusive `range` in the BLOB as an `INT` -in little-endian byte order. - -* If number of bytes in `range` < number of bytes for `INT`, zeros are padded. -* If number of bytes in `range` > number of bytes for `INT`, extra bytes are ignored. - -```rhai -let b = blob(); - -b += 1; b += 2; b += 3; b += 4; b += 5; - -let x = b.parse_le_int(1..=3); // parse three bytes - -print(x.to_hex()); // prints "040302" -``` -
- -
-
-
-
-

fn pop

- -```rust,ignore -fn pop(array: Array) -> ? -fn pop(blob: Blob) -> int -fn pop(string: String) -> ? -fn pop(string: String, len: int) -> String -``` - -
-
- - -
- -
-Remove the last element from the array and return it. - -If the array is empty, `()` is returned. -
- - -
-
-
-
-

fn print

- -```rust,ignore -fn print() -> String -fn print(array: Array) -> String -fn print(character: char) -> String -fn print(value: bool) -> String -fn print(string: String) -> String -fn print(unit: ?) -> String -fn print(map: Map) -> String -fn print(number: f32) -> String -fn print(number: float) -> String -fn print(item: ?) -> String -``` - -
-
- -
- - - -
-
-
-
-

fn push

- -```rust,ignore -fn push(array: Array, item: ?) -fn push(blob: Blob, value: int) -``` - -
-
- - -
- -
-Add a new element, which is not another array, to the end of the array. - -If `item` is `Array`, then `append` is more specific and will be called instead. -
- - -
-
-
-
-

fn range

- -```rust,ignore -fn range(range: Range, step: float) -> StepRange -fn range(from: u64, to: u64) -> Range -fn range(range: Range, step: u8) -> StepRange -fn range(range: Range, step: u128) -> StepRange -fn range(from: u8, to: u8) -> Range -fn range(from: i128, to: i128) -> Range -fn range(from: u128, to: u128) -> Range -fn range(from: i32, to: i32) -> Range -fn range(range: Range, step: i128) -> StepRange -fn range(from: i16, to: i16) -> Range -fn range(range: Range, step: i32) -> StepRange -fn range(range: Range, step: i16) -> StepRange -fn range(range: Range, step: u64) -> StepRange -fn range(from: u32, to: u32) -> Range -fn range(from: int, to: int) -> Range -fn range(range: Range, step: i8) -> StepRange -fn range(from: i8, to: i8) -> Range -fn range(from: u16, to: u16) -> Range -fn range(range: Range, step: u32) -> StepRange -fn range(range: Range, step: u16) -> StepRange -fn range(range: Range, step: int) -> StepRange -fn range(from: u32, to: u32, step: u32) -> StepRange -fn range(from: u64, to: u64, step: u64) -> StepRange -fn range(from: i8, to: i8, step: i8) -> StepRange -fn range(from: u16, to: u16, step: u16) -> StepRange -fn range(from: u8, to: u8, step: u8) -> StepRange -fn range(from: u128, to: u128, step: u128) -> StepRange -fn range(from: float, to: float, step: float) -> StepRange -fn range(from: i32, to: i32, step: i32) -> StepRange -fn range(from: int, to: int, step: int) -> StepRange -fn range(from: i16, to: i16, step: i16) -> StepRange -fn range(from: i128, to: i128, step: i128) -> StepRange -``` - -
-
- - -
- -
-Return an iterator over an exclusive range, each iteration increasing by `step`. - -If `range` is reversed and `step` < 0, iteration goes backwards. - -Otherwise, if `range` is empty, an empty iterator is returned. -
- - -
-
-
-
-

fn reduce

- -```rust,ignore -fn reduce(array: Array, reducer: String) -> ? -fn reduce(array: Array, reducer: FnPtr) -> ? -fn reduce(array: Array, reducer: FnPtr, initial: ?) -> ? -fn reduce(array: Array, reducer: String, initial: ?) -> ? -``` - -
-
- - - - -
- -
-Reduce an array by iterating through all elements while applying a function named by `reducer`. -
- - - - -
-
-
-
-

fn reduce_rev

- -```rust,ignore -fn reduce_rev(array: Array, reducer: String) -> ? -fn reduce_rev(array: Array, reducer: FnPtr) -> ? -fn reduce_rev(array: Array, reducer: FnPtr, initial: ?) -> ? -fn reduce_rev(array: Array, reducer: String, initial: ?) -> ? -``` - -
-
- - - - -
- -
-Reduce an array by iterating through all elements, in _reverse_ order, -while applying a function named by `reducer`. -
- - - - -
-
-
-
-

fn remove

- -```rust,ignore -fn remove(blob: Blob, index: int) -> int -fn remove(array: Array, index: int) -> ? -fn remove(string: String, character: char) -fn remove(map: Map, property: String) -> ? -fn remove(string: String, sub_string: String) -``` - -
-
- - -
- -
-Remove the byte at the specified `index` from the BLOB and return it. - -* If `index` < 0, position counts from the end of the BLOB (`-1` is the last byte). -* If `index` < -length of BLOB, zero is returned. -* If `index` ≥ length of BLOB, zero is returned. -
- - -
-
-
-
-

fn replace

- -```rust,ignore -fn replace(string: String, find_character: char, substitute_character: char) -fn replace(string: String, find_string: String, substitute_character: char) -fn replace(string: String, find_character: char, substitute_string: String) -fn replace(string: String, find_string: String, substitute_string: String) -``` - -
-
- - -
- -
-Replace all occurrences of the specified character in the string with another character. -
- - -
-
-
-
-

fn retain

- -```rust,ignore -fn retain(array: Array, range: Range) -> Array -fn retain(blob: Blob, range: RangeInclusive) -> Blob -fn retain(array: Array, filter: FnPtr) -> Array -fn retain(map: Map, filter: FnPtr) -> Map -fn retain(blob: Blob, range: Range) -> Blob -fn retain(array: Array, range: RangeInclusive) -> Array -fn retain(array: Array, filter: String) -> Array -fn retain(blob: Blob, start: int, len: int) -> Blob -fn retain(array: Array, start: int, len: int) -> Array -``` - -
-
- - -
- -
-Remove all elements in the array not within an exclusive `range` and return them as a new array. -
- - -
-
-
-
-

fn reverse

- -```rust,ignore -fn reverse(blob: Blob) -fn reverse(array: Array) -``` - -
-
- - -
- -
-Reverse the BLOB. -
- - -
-
-
-
-

fn round

- -```rust,ignore -fn round(x: float) -> float -``` - -
-
- -
- -
-Return the nearest whole number closest to the floating-point number. -Rounds away from zero. -
- -
-
-
-
-

fn set

- -```rust,ignore -fn set(blob: Blob, index: int, value: int) -fn set(array: Array, index: int, value: ?) -fn set(string: String, index: int, character: char) -fn set(map: Map, property: String, value: ?) -``` - -
-
- - -
- -
-Set the particular `index` position in the BLOB to a new byte `value`. - -* If `index` < 0, position counts from the end of the BLOB (`-1` is the last byte). -* If `index` < -length of BLOB, the BLOB is not modified. -* If `index` ≥ length of BLOB, the BLOB is not modified. -
- - -
-
-
-
-

fn set_bit

- -```rust,ignore -fn set_bit(value: int, bit: int, new_value: bool) -``` - -
-
- - -
- -
-Set the specified `bit` in the number if the new value is `true`. -Clear the `bit` if the new value is `false`. - -If `bit` < 0, position counts from the MSB (Most Significant Bit). -
- - -
-
-
-
-

fn set_bits

- -```rust,ignore -fn set_bits(value: int, range: Range, new_value: int) -fn set_bits(value: int, range: RangeInclusive, new_value: int) -fn set_bits(value: int, bit: int, bits: int, new_value: int) -``` - -
-
- - -
- -
-Replace an exclusive range of bits in the number with a new value. -
- - -
-
-
-
-

fn set_tag

- -```rust,ignore -fn set_tag(value: ?, tag: int) -``` - -
-
- - -
- -
-Set the _tag_ of a `Dynamic` value. -
- - -
-
-
-
-

fn shift

- -```rust,ignore -fn shift(blob: Blob) -> int -fn shift(array: Array) -> ? -``` - -
-
- - -
- -
-Remove the first byte from the BLOB and return it. - -If the BLOB is empty, zero is returned. -
- - -
-
-
-
-

fn sign

- -```rust,ignore -fn sign(x: f32) -> int -fn sign(x: i16) -> int -fn sign(x: float) -> int -fn sign(x: i32) -> int -fn sign(x: i128) -> int -fn sign(x: i8) -> int -fn sign(x: int) -> int -``` - -
-
- -
- -
-Return the sign (as an integer) of the floating-point number according to the following: - -* `0` if the number is zero -* `1` if the number is positive -* `-1` if the number is negative -
- -
-
-
-
-

fn sin

- -```rust,ignore -fn sin(x: float) -> float -``` - -
-
- -
- -
-Return the sine of the floating-point number in radians. -
- -
-
-
-
-

fn sinh

- -```rust,ignore -fn sinh(x: float) -> float -``` - -
-
- -
- -
-Return the hyperbolic sine of the floating-point number in radians. -
- -
-
-
-
-

fn sleep

- -```rust,ignore -fn sleep(seconds: int) -fn sleep(seconds: float) -``` - -
-
- - -
- -
-Block the current thread for a particular number of `seconds`. -
- - -
-
-
-
-

fn some

- -```rust,ignore -fn some(array: Array, filter: FnPtr) -> bool -fn some(array: Array, filter: String) -> bool -``` - -
-
- - - - -
- -
-Return `true` if any element in the array that returns `true` when applied the `filter` function. -
- - - - -
-
-
-
-

fn sort

- -```rust,ignore -fn sort(array: Array) -fn sort(array: Array, comparer: FnPtr) -fn sort(array: Array, comparer: String) -``` - -
-
- - - -
- -
-Sort the array. - -All elements in the array must be of the same data type. -
- - - -
-
-
-
-

fn splice

- -```rust,ignore -fn splice(array: Array, range: RangeInclusive, replace: Array) -fn splice(blob: Blob, range: Range, replace: Blob) -fn splice(array: Array, range: Range, replace: Array) -fn splice(blob: Blob, range: RangeInclusive, replace: Blob) -fn splice(blob: Blob, start: int, len: int, replace: Blob) -fn splice(array: Array, start: int, len: int, replace: Array) -``` - -
-
- - -
- -
-Replace an inclusive range of the array with another array. -
- - -
-
-
-
-

fn split

- -```rust,ignore -fn split(string: String) -> Array -fn split(string: String, delimiter: char) -> Array -fn split(array: Array, index: int) -> Array -fn split(blob: Blob, index: int) -> Blob -fn split(string: String, index: int) -> Array -fn split(string: String, delimiter: String) -> Array -fn split(string: String, delimiter: String, segments: int) -> Array -fn split(string: String, delimiter: char, segments: int) -> Array -``` - -
-
- - -
- -
-Split the string into segments based on whitespaces, returning an array of the segments. -
- - -
-
-
-
-

fn split_rev

- -```rust,ignore -fn split_rev(string: String, delimiter: String) -> Array -fn split_rev(string: String, delimiter: char) -> Array -fn split_rev(string: String, delimiter: String, segments: int) -> Array -fn split_rev(string: String, delimiter: char, segments: int) -> Array -``` - -
-
- - -
- -
-Split the string into segments based on a `delimiter` string, returning an array of the -segments in _reverse_ order. -
- - -
-
-
-
-

fn sqrt

- -```rust,ignore -fn sqrt(x: float) -> float -``` - -
-
- -
- -
-Return the square root of the floating-point number. -
- -
-
-
-
-

fn start

- -```rust,ignore -fn start(range: RangeInclusive) -> int -fn start(range: Range) -> int -``` - -
-
- -
- -
-Return the start of the inclusive range. -
- -
-
-
-
-

fn starts_with

- -```rust,ignore -fn starts_with(string: String, match_string: String) -> bool -``` - -
-
- - -
- -
-Return `true` if the string starts with a specified string. -
- - -
-
-
-
-

fn sub_string

- -```rust,ignore -fn sub_string(string: String, range: Range) -> String -fn sub_string(string: String, range: RangeInclusive) -> String -fn sub_string(string: String, start: int) -> String -fn sub_string(string: String, start: int, len: int) -> String -``` - -
-
- - -
- -
-Copy an exclusive range of characters from the string and return it as a new string. -
- - -
-
-
-
-

fn tag

- -```rust,ignore -fn tag(value: ?) -> int -``` - -
-
- - -
- -
-Return the _tag_ of a `Dynamic` value. -
- - -
-
-
-
-

fn take

- -```rust,ignore -fn take(value: ?) -> ? -``` - -
-
- - -
- -
-Take ownership of the data in a `Dynamic` value and return it. -The data is _NOT_ cloned. - -The original value is replaced with `()`. -
- - -
-
-
-
-

fn tan

- -```rust,ignore -fn tan(x: float) -> float -``` - -
-
- -
- -
-Return the tangent of the floating-point number in radians. -
- -
-
-
-
-

fn tanh

- -```rust,ignore -fn tanh(x: float) -> float -``` - -
-
- -
- -
-Return the hyperbolic tangent of the floating-point number in radians. -
- -
-
-
-
-

fn timestamp

- -```rust,ignore -fn timestamp() -> Instant -``` - -
-
- - -
- -
-Create a timestamp containing the current system time. -
- - -
-
-
-
-

fn to_array

- -```rust,ignore -fn to_array(blob: Blob) -> Array -``` - -
-
- - -
- -
-Convert the BLOB into an array of integers. -
- - -
-
-
-
-

fn to_binary

- -```rust,ignore -fn to_binary(value: i8) -> String -fn to_binary(value: int) -> String -fn to_binary(value: u16) -> String -fn to_binary(value: u8) -> String -fn to_binary(value: i32) -> String -fn to_binary(value: i128) -> String -fn to_binary(value: u64) -> String -fn to_binary(value: u128) -> String -fn to_binary(value: i16) -> String -fn to_binary(value: u32) -> String -``` - -
-
- -
- -
-Convert the `value` into a string in binary format. -
- -
-
-
-
-

fn to_blob

- -```rust,ignore -fn to_blob(string: String) -> Blob -``` - -
-
- - -
- -
-Convert the string into an UTF-8 encoded byte-stream as a BLOB. -
- - -
-
-
-
-

fn to_chars

- -```rust,ignore -fn to_chars(string: String) -> Array -``` - -
-
- - -
- -
-Return an array containing all the characters of the string. -
- - -
-
-
-
-

fn to_debug

- -```rust,ignore -fn to_debug(item: ?) -> String -fn to_debug(number: float) -> String -fn to_debug(number: f32) -> String -fn to_debug(map: Map) -> String -fn to_debug(unit: ?) -> String -fn to_debug(string: String) -> String -fn to_debug(character: char) -> String -fn to_debug(f: FnPtr) -> String -fn to_debug(value: bool) -> String -fn to_debug(array: Array) -> String -``` - -
-
- -
- -
-Convert the value of the `item` into a string in debug format. -
- -
-
-
-
-

fn to_degrees

- -```rust,ignore -fn to_degrees(x: float) -> float -``` - -
-
- -
- -
-Convert radians to degrees. -
- -
-
-
-
-

fn to_float

- -```rust,ignore -fn to_float() -fn to_float(x: f32) -> float -fn to_float() -fn to_float() -fn to_float() -fn to_float() -fn to_float() -fn to_float() -fn to_float() -fn to_float() -fn to_float() -fn to_float() -``` - -
-
- -
- -
-Convert the 32-bit floating-point number to 64-bit. -
- -
-
-
-
-

fn to_hex

- -```rust,ignore -fn to_hex(value: i16) -> String -fn to_hex(value: u128) -> String -fn to_hex(value: u32) -> String -fn to_hex(value: int) -> String -fn to_hex(value: i8) -> String -fn to_hex(value: i128) -> String -fn to_hex(value: u64) -> String -fn to_hex(value: u8) -> String -fn to_hex(value: u16) -> String -fn to_hex(value: i32) -> String -``` - -
-
- -
- -
-Convert the `value` into a string in hex format. -
- -
-
-
-
-

fn to_int

- -```rust,ignore -fn to_int() -fn to_int() -fn to_int() -fn to_int() -fn to_int() -fn to_int() -fn to_int() -fn to_int() -fn to_int() -fn to_int() -fn to_int(x: float) -> int -fn to_int(x: f32) -> int -fn to_int() -``` - -
-
- -
- -
-Convert the floating-point number into an integer. -
- -
-
-
-
-

fn to_json

- -```rust,ignore -fn to_json(map: Map) -> String -``` - -
-
- - - - -
- -
-Return the JSON representation of the object map. -
- - - - -
-
-
-
-

fn to_lower

- -```rust,ignore -fn to_lower(string: String) -> String -fn to_lower(character: char) -> char -``` - -
-
- - -
- -
-Convert the string to all lower-case and return it as a new string. -
- - -
-
-
-
-

fn to_octal

- -```rust,ignore -fn to_octal(value: i16) -> String -fn to_octal(value: u128) -> String -fn to_octal(value: u32) -> String -fn to_octal(value: int) -> String -fn to_octal(value: i8) -> String -fn to_octal(value: i128) -> String -fn to_octal(value: u64) -> String -fn to_octal(value: u16) -> String -fn to_octal(value: u8) -> String -fn to_octal(value: i32) -> String -``` - -
-
- -
- -
-Convert the `value` into a string in octal format. -
- -
-
-
-
-

fn to_radians

- -```rust,ignore -fn to_radians(x: float) -> float -``` - -
-
- -
- -
-Convert degrees to radians. -
- -
-
-
-
-

fn to_string

- -```rust,ignore -fn to_string(unit: ?) -> String -fn to_string(string: String) -> String -fn to_string(value: bool) -> String -fn to_string(character: char) -> String -fn to_string(array: Array) -> String -fn to_string(item: ?) -> String -fn to_string(map: Map) -> String -fn to_string(number: f32) -> String -fn to_string(number: float) -> String -``` - -
-
- -
- -
-Return the empty string. -
- -
-
-
-
-

fn to_upper

- -```rust,ignore -fn to_upper(character: char) -> char -fn to_upper(string: String) -> String -``` - -
-
- - -
- -
-Convert the character to upper-case and return it as a new character. -
- - -
-
-
-
-

fn trim

- -```rust,ignore -fn trim(string: String) -``` - -
-
- - -
- -
-Remove whitespace characters from both ends of the string. -
- - -
-
-
-
-

fn truncate

- -```rust,ignore -fn truncate(blob: Blob, len: int) -fn truncate(array: Array, len: int) -fn truncate(string: String, len: int) -``` - -
-
- - -
- -
-Cut off the BLOB at the specified length. - -* If `len` ≤ 0, the BLOB is cleared. -* If `len` ≥ length of BLOB, the BLOB is not truncated. -
- - -
-
-
-
-

get/set u128.is_even

- -```rust,ignore -get u128.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set u128.is_odd

- -```rust,ignore -get u128.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set u128.is_zero

- -```rust,ignore -get u128.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

get/set u16.is_even

- -```rust,ignore -get u16.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set u16.is_odd

- -```rust,ignore -get u16.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set u16.is_zero

- -```rust,ignore -get u16.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

get/set u32.is_even

- -```rust,ignore -get u32.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set u32.is_odd

- -```rust,ignore -get u32.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set u32.is_zero

- -```rust,ignore -get u32.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

get/set u64.is_even

- -```rust,ignore -get u64.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set u64.is_odd

- -```rust,ignore -get u64.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set u64.is_zero

- -```rust,ignore -get u64.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

get/set u8.is_even

- -```rust,ignore -get u8.is_even -> bool -``` - -
-
- -
- -
-Return true if the number is even. -
- -
-
-
-
-

get/set u8.is_odd

- -```rust,ignore -get u8.is_odd -> bool -``` - -
-
- -
- -
-Return true if the number is odd. -
- -
-
-
-
-

get/set u8.is_zero

- -```rust,ignore -get u8.is_zero -> bool -``` - -
-
- -
- -
-Return true if the number is zero. -
- -
-
-
-
-

fn values

- -```rust,ignore -fn values(map: Map) -> Array -``` - -
-
- - -
- -
-Return an array with all the property values in the object map. -
- - -
-
-
-
-

fn write_ascii

- -```rust,ignore -fn write_ascii(blob: Blob, range: Range, string: String) -fn write_ascii(blob: Blob, range: RangeInclusive, string: String) -fn write_ascii(blob: Blob, start: int, len: int, string: String) -``` - -
-
- -
- -
-Write an ASCII string to the bytes within an exclusive `range` in the BLOB. - -Each ASCII character encodes to one single byte in the BLOB. -Non-ASCII characters are ignored. - -* If number of bytes in `range` < length of `string`, extra bytes in `string` are not written. -* If number of bytes in `range` > length of `string`, extra bytes in `range` are not modified. - -```rhai -let b = blob(8); - -b.write_ascii(1..5, "hello, world!"); - -print(b); // prints "[0068656c6c000000]" -``` -
- -
-
-
-
-

fn write_be

- -```rust,ignore -fn write_be(blob: Blob, range: Range, value: float) -fn write_be(blob: Blob, range: RangeInclusive, value: int) -fn write_be(blob: Blob, range: Range, value: int) -fn write_be(blob: Blob, range: RangeInclusive, value: float) -fn write_be(blob: Blob, start: int, len: int, value: float) -fn write_be(blob: Blob, start: int, len: int, value: int) -``` - -
-
- -
- -
-Write a `FLOAT` value to the bytes within an exclusive `range` in the BLOB -in big-endian byte order. - -* If number of bytes in `range` < number of bytes for `FLOAT`, extra bytes in `FLOAT` are not written. -* If number of bytes in `range` > number of bytes for `FLOAT`, extra bytes in `range` are not modified. -
- -
-
-
-
-

fn write_le

- -```rust,ignore -fn write_le(blob: Blob, range: RangeInclusive, value: int) -fn write_le(blob: Blob, range: Range, value: float) -fn write_le(blob: Blob, range: RangeInclusive, value: float) -fn write_le(blob: Blob, range: Range, value: int) -fn write_le(blob: Blob, start: int, len: int, value: int) -fn write_le(blob: Blob, start: int, len: int, value: float) -``` - -
-
- -
- -
-Write an `INT` value to the bytes within an inclusive `range` in the BLOB -in little-endian byte order. - -* If number of bytes in `range` < number of bytes for `INT`, extra bytes in `INT` are not written. -* If number of bytes in `range` > number of bytes for `INT`, extra bytes in `range` are not modified. - -```rhai -let b = blob(8); - -b.write_le_int(1..=3, 0x12345678); - -print(b); // prints "[0078563400000000]" -``` -
- -
-
-
-
-

fn write_utf8

- -```rust,ignore -fn write_utf8(blob: Blob, range: Range, string: String) -fn write_utf8(blob: Blob, range: RangeInclusive, string: String) -fn write_utf8(blob: Blob, start: int, len: int, string: String) -``` - -
-
- -
- -
-Write a string to the bytes within an exclusive `range` in the BLOB in UTF-8 encoding. - -* If number of bytes in `range` < length of `string`, extra bytes in `string` are not written. -* If number of bytes in `range` > length of `string`, extra bytes in `range` are not modified. - -```rhai -let b = blob(8); - -b.write_utf8(1..5, "朝には紅顔ありて夕べには白骨となる"); - -print(b); // prints "[00e69c9de3000000]" -``` -
- -
-
-
-
-

fn zip

- -```rust,ignore -fn zip(array1: Array, array2: Array, map: FnPtr) -> Array -``` - -
-
- - - -
- -
-Iterate through all elements in two arrays, applying a `mapper` function to them, -and return a new array containing the results. -
- - - -
-
-
+# Global Builtin Rhai Functions diff --git a/docs/src/modules/stdlib.md b/docs/src/modules/stdlib.md index 6f815cf..9d2703e 100644 --- a/docs/src/modules/stdlib.md +++ b/docs/src/modules/stdlib.md @@ -1,1039 +1 @@ -# monitor - -```Namespace: global/std/monitor``` - -
-

fn all_resolutions

- -```rust,ignore -fn all_resolutions() -> Vec<[int;2]> -``` - -
-
- - - -
- -
-Get the resolutions of all connected monitors. -
- - - -
-
-
-
-

fn all_resolutions_str

- -```rust,ignore -fn all_resolutions_str() -> String -``` - -
-
- - - -
- -
-Get the resolutions of all connected monitors as a string. -
- - - -
-
-
-
-

fn count

- -```rust,ignore -fn count() -> int -``` - -
-
- - - -
- -
-Get the number of connected monitors. -
- - - -
-
-
-
-

fn dimensions

- -```rust,ignore -fn dimensions(index: int) -> [int;4] -``` - -
-
- - - - -
- -
-Get the dimensions (x, y, width, height) of a specific monitor. -
- - - - -
-
-
-
-

fn dimensions_str

- -```rust,ignore -fn dimensions_str(index: int) -> String -``` - -
-
- - - - -
- -
-Get the dimensions of a specific monitor as a string. -
- - - - -
-
-
-
-

fn dpi

- -```rust,ignore -fn dpi(index: int) -> float -``` - -
-
- - - - -
- -
-Get the DPI (dots per inch) of a specific monitor. -
- - - - -
-
-
-
-

fn dpi_str

- -```rust,ignore -fn dpi_str(index: int) -> String -``` - -
-
- - - - -
- -
-Get the DPI of a specific monitor as a string. -
- - - - -
-
-
-
-

fn primary_resolution

- -```rust,ignore -fn primary_resolution() -> [int;2] -``` - -
-
- - - -
- -
-Get the resolution of the primary monitor. -
- - - -
-
-
-
-

fn primary_resolution_str

- -```rust,ignore -fn primary_resolution_str() -> String -``` - -
-
- - - -
- -
-Get the resolution of the primary monitor as a string. -
- - - -
-
-
- -# text - -```Namespace: global/std/text``` - -
-

fn to_camel_case

- -```rust,ignore -fn to_camel_case(text: String) -> String -``` - -
-
- - - - -
- -
-Converts a string to camel case. -
- - - - -
-
-
-
-

fn to_lower

- -```rust,ignore -fn to_lower(s: String) -> String -``` - -
-
- - - - -
- -
-Converts a string to lowercase. -
- - - - -
-
-
-
-

fn to_slug

- -```rust,ignore -fn to_slug(text: String) -> String -``` - -
-
- - - - -
- -
-Converts a string to a slug (lowercase words joined by hyphens). -
- - - - -
-
-
-
-

fn to_upper

- -```rust,ignore -fn to_upper(s: String) -> String -``` - -
-
- - - - -
- -
-Converts a string to uppercase. -
- - - - -
-
-
-
-

fn truncate_chars

- -```rust,ignore -fn truncate_chars(text: String, max_chars: int) -> String -``` - -
-
- - - - -
- -
-Truncates a string to the specified number of characters. -
- - - - -
-
-
- -# command - -```Namespace: global/std/command``` - -
-

fn run

- -```rust,ignore -fn run(cmd: String) -``` - -
-
- - - - -
- -
-Executes a shell command without capturing the output. -
- - - - -
-
-
-
-

fn run_and_read

- -```rust,ignore -fn run_and_read(cmd: String) -> String -``` - -
-
- - - - -
- -
-Executes a shell command and captures its output. -
- - - - -
-
-
- -# env - -```Namespace: global/std/env``` - -
-

fn get_current_dir

- -```rust,ignore -fn get_current_dir() -> String -``` - -
-
- - - -
- -
-Get the current working directory. -
- - - -
-
-
-
-

fn get_env

- -```rust,ignore -fn get_env(var: String) -> String -``` - -
-
- - - - -
- -
-Get the value of an environment variable. -
- - - - -
-
-
-
-

fn get_home_dir

- -```rust,ignore -fn get_home_dir() -> String -``` - -
-
- - - -
- -
-Get the path to the home directory. -
- - - -
-
-
-
-

fn get_username

- -```rust,ignore -fn get_username() -> String -``` - -
-
- - - -
- -
-Get the current username. -
- - - -
-
-
-
-

fn set_env

- -```rust,ignore -fn set_env(var: String, value: String) -``` - -
-
- - - - -
- -
-Set the value of an environment variable. -
- - - - -
-
-
+# Std Library