Runlet.PID (runlet v1.2.7)

View Source

Conversion functions between Runlet and Erlang PIDs

Summary

Functions

Convert an Elixir PID to a number

Convert a representation of an Elixir PID.

Convert a Elixir PID to a string

Types

t()

@type t() :: integer() | float()

Functions

to_float(pid)

@spec to_float(pid() | binary()) :: float()

Convert an Elixir PID to a number

Examples:

iex> Runlet.PID.to_float(:erlang.list_to_pid(~c"<0.1234.0>"))
1234.0
iex> Runlet.PID.to_float(:erlang.list_to_pid(~c"<0.1234.56>"))
1234.56

to_pid(x)

@spec to_pid(t() | pid() | String.t() | charlist()) :: pid()

Convert a representation of an Elixir PID.

Examples:

iex> Runlet.PID.to_pid(String.to_integer(Runlet.PID.to_string(:erlang.list_to_pid(~c"<0.1234.0>"))))
#PID<0.1234.0>

to_string(pid)

@spec to_string(pid()) :: binary()

Convert a Elixir PID to a string

Examples:

iex> Runlet.PID.to_string(:erlang.list_to_pid(~c"<0.1234.0>"))
"1234"
iex> Runlet.PID.to_string(:erlang.list_to_pid(~c"<0.1234.56>"))
"1234.56"