gossamer/uint8_array

Types

pub type Uint8Array

Values

pub fn at(array: Uint8Array, index: Int) -> Result(Int, Nil)

Returns the item located at the specified index. A negative index will count back from the last item.

pub fn buffer(array: Uint8Array) -> array_buffer.ArrayBuffer

The ArrayBuffer instance referenced by the array.

pub fn byte_length(array: Uint8Array) -> Int

The length in bytes of the array.

pub fn byte_offset(array: Uint8Array) -> Int

The offset in bytes of the array.

pub fn copy_within(
  array: Uint8Array,
  target: Int,
  start: Int,
) -> Uint8Array

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target.

pub fn copy_within_range(
  array: Uint8Array,
  target: Int,
  start: Int,
  end: Int,
) -> Uint8Array

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target.

pub fn every(
  array: Uint8Array,
  predicate: fn(Int) -> Bool,
) -> Bool

Determines whether all the members of an array satisfy the specified test.

pub fn fill(array: Uint8Array, value: Int) -> Uint8Array

Changes all array elements from start to end index to a static value and returns the modified array.

pub fn fill_range(
  array: Uint8Array,
  value: Int,
  start: Int,
  end: Int,
) -> Uint8Array

Changes array elements from start to end index to a static value and returns the modified array.

pub fn filter(
  array: Uint8Array,
  predicate: fn(Int) -> Bool,
) -> Uint8Array

Returns the elements of an array that meet the condition specified in a callback function.

pub fn find(
  array: Uint8Array,
  predicate: fn(Int) -> Bool,
) -> Result(Int, Nil)

Returns the value of the first element in the array where predicate is true.

pub fn find_index(
  array: Uint8Array,
  predicate: fn(Int) -> Bool,
) -> Int

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

pub fn find_last(
  array: Uint8Array,
  predicate: fn(Int) -> Bool,
) -> Result(Int, Nil)

Returns the value of the last element in the array where predicate is true.

pub fn find_last_index(
  array: Uint8Array,
  predicate: fn(Int) -> Bool,
) -> Int

Returns the index of the last element in the array where predicate is true, and -1 otherwise.

pub fn for_each(
  array: Uint8Array,
  callback: fn(Int) -> Nil,
) -> Nil

Performs the specified action for each element in an array.

pub fn from_base64(string: String) -> Uint8Array

Creates a new Uint8Array from a base64-encoded string.

pub fn from_buffer(
  buffer: array_buffer.ArrayBuffer,
) -> Uint8Array
pub fn from_hex(string: String) -> Uint8Array

Creates a new Uint8Array from a base16-encoded string.

pub fn from_length(length: Int) -> Uint8Array
pub fn from_list(list: List(Int)) -> Uint8Array
pub fn includes(array: Uint8Array, value: Int) -> Bool

Determines whether an array includes a certain element, returning true or false as appropriate.

pub fn includes_from(
  array: Uint8Array,
  value: Int,
  from_index: Int,
) -> Bool

Determines whether an array includes a certain element, searching from the given index.

pub fn index_every(
  array: Uint8Array,
  predicate: fn(Int, Int) -> Bool,
) -> Bool

Determines whether all the members of an array satisfy the specified test. The predicate receives the value and its index.

pub fn index_filter(
  array: Uint8Array,
  predicate: fn(Int, Int) -> Bool,
) -> Uint8Array

Returns the elements of an array that meet the condition specified in a callback function. The predicate receives the value and its index.

pub fn index_find(
  array: Uint8Array,
  predicate: fn(Int, Int) -> Bool,
) -> Result(Int, Nil)

Returns the value of the first element in the array where predicate is true. The predicate receives the value and its index.

pub fn index_find_index(
  array: Uint8Array,
  predicate: fn(Int, Int) -> Bool,
) -> Int

Returns the index of the first element in the array where predicate is true, and -1 otherwise. The predicate receives the value and its index.

pub fn index_find_last(
  array: Uint8Array,
  predicate: fn(Int, Int) -> Bool,
) -> Result(Int, Nil)

Returns the value of the last element in the array where predicate is true. The predicate receives the value and its index.

pub fn index_find_last_index(
  array: Uint8Array,
  predicate: fn(Int, Int) -> Bool,
) -> Int

Returns the index of the last element in the array where predicate is true, and -1 otherwise. The predicate receives the value and its index.

pub fn index_for_each(
  array: Uint8Array,
  callback: fn(Int, Int) -> Nil,
) -> Nil

Performs the specified action for each element in an array. The callback receives the value and its index.

pub fn index_map(
  array: Uint8Array,
  callback: fn(Int, Int) -> Int,
) -> Uint8Array

Calls a defined callback function on each element of an array, and returns an array that contains the results. The callback receives the value and its index.

pub fn index_of(array: Uint8Array, value: Int) -> Int

Returns the index of the first occurrence of a value in an array.

pub fn index_of_from(
  array: Uint8Array,
  value: Int,
  from_index: Int,
) -> Int

Returns the index of the first occurrence of a value in an array, searching from the given index.

pub fn index_reduce(
  array: Uint8Array,
  initial: a,
  callback: fn(a, Int, Int) -> a,
) -> a

Calls the specified callback function for all the elements in an array. The callback receives the accumulator, value, and index.

pub fn index_reduce_right(
  array: Uint8Array,
  initial: a,
  callback: fn(a, Int, Int) -> a,
) -> a

Calls the specified callback function for all the elements in an array, in descending order. The callback receives the accumulator, value, and index.

pub fn index_some(
  array: Uint8Array,
  predicate: fn(Int, Int) -> Bool,
) -> Bool

Determines whether the specified callback function returns true for any element of an array. The predicate receives the value and its index.

pub fn join(array: Uint8Array, separator: String) -> String

Adds all the elements of an array separated by the specified separator string.

pub fn last_index_of(array: Uint8Array, value: Int) -> Int

Returns the index of the last occurrence of a value in an array.

pub fn last_index_of_from(
  array: Uint8Array,
  value: Int,
  from_index: Int,
) -> Int

Returns the index of the last occurrence of a value in an array, searching from the given index.

pub fn length(array: Uint8Array) -> Int

The length of the array.

pub fn map(
  array: Uint8Array,
  callback: fn(Int) -> Int,
) -> Uint8Array

Calls a defined callback function on each element of an array, and returns an array that contains the results.

pub fn new() -> Uint8Array
pub fn reduce(
  array: Uint8Array,
  initial: a,
  callback: fn(a, Int) -> a,
) -> a

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

pub fn reduce_right(
  array: Uint8Array,
  initial: a,
  callback: fn(a, Int) -> a,
) -> a

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

pub fn reverse(array: Uint8Array) -> Uint8Array

Reverses the elements in an Array.

pub fn set(array: Uint8Array, values: Uint8Array) -> Nil

Sets a value or an array of values.

pub fn set_from_base64(
  array: Uint8Array,
  string: String,
) -> #(Int, Int)

Sets the Uint8Array from a base64-encoded string, returning the number of bytes read and written.

pub fn set_from_hex(
  array: Uint8Array,
  string: String,
) -> #(Int, Int)

Sets the Uint8Array from a base16-encoded string, returning the number of bytes read and written.

pub fn set_with_offset(
  array: Uint8Array,
  values: Uint8Array,
  offset: Int,
) -> Nil

Sets a value or an array of values starting at the given offset.

pub fn slice(array: Uint8Array) -> Uint8Array

Returns a section of an array.

pub fn slice_from(array: Uint8Array, start: Int) -> Uint8Array

Returns a section of an array starting from the given index.

pub fn slice_range(
  array: Uint8Array,
  start: Int,
  end: Int,
) -> Uint8Array

Returns a section of an array from start to end (exclusive).

pub fn some(
  array: Uint8Array,
  predicate: fn(Int) -> Bool,
) -> Bool

Determines whether the specified callback function returns true for any element of an array.

pub fn sort(
  array: Uint8Array,
  compare: fn(Int, Int) -> order.Order,
) -> Uint8Array

Sorts an array.

pub fn subarray(
  array: Uint8Array,
  begin: Int,
  end: Int,
) -> Uint8Array

Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.

pub fn to_base64(array: Uint8Array) -> String

Converts the Uint8Array to a base64-encoded string.

pub fn to_hex(array: Uint8Array) -> String

Converts the Uint8Array to a base16-encoded string.

pub fn to_list(array: Uint8Array) -> List(Int)

Converts the array to a List(Int).

pub fn to_reversed(array: Uint8Array) -> Uint8Array

Copies the array and returns the copy with the elements in reverse order.

pub fn to_sorted(
  array: Uint8Array,
  compare: fn(Int, Int) -> order.Order,
) -> Uint8Array

Copies and sorts the array.

pub fn with(
  array: Uint8Array,
  index: Int,
  value: Int,
) -> Uint8Array

Copies the array and inserts the given number at the provided index.

Search Document