Beaver.MLIR.StringRef (beaver v0.4.0)

This module defines functions working with MLIR StringRef.

Summary

Functions

Create a Elixir owned null-terminated C string from a Elixir bitstring and create a StringRef from it.

Get the data of the StringRef as an array pointer of unsigned 8-bit integers.

Get the length of the StringRef as Erlang integer.

Types

t()

@type t() :: %Beaver.MLIR.StringRef{ref: term()}

Functions

create(value)

Create a Elixir owned null-terminated C string from a Elixir bitstring and create a StringRef from it.

Not really a reference

A StringRef created in Elixir is not a reference to the BEAM binary as argument. Instead, a copy is made. In other words, excessively creating StringRef using this function can lead to memory leak.

data(str)

Get the data of the StringRef as an array pointer of unsigned 8-bit integers.

length(str)

Get the length of the StringRef as Erlang integer.

make(value)