Skip to content

Strings

[Source]

Moving bytes between Pony and C without guessing at their length.

Binaries may contain NUL bytes, so anything decoded from a message is trimmed by the length the C layer reports and never by strlen.

primitive val Strings

Constructors

create

[Source]

new val create()
: Strings val^

Returns


Public Functions

buffer

[Source]

A zeroed byte buffer of size bytes for the C layer to fill.

fun box buffer(
  size: USize val)
: Array[U8 val] val

Parameters

Returns


from_bytes

[Source]

Takes the first len bytes of source as a String.

fun box from_bytes(
  source: Array[U8 val] val,
  len: USize val)
: String val^

Parameters

Returns


null_trimmed

[Source]

Takes the bytes before the first NUL, for NUL terminated C strings.

fun box null_trimmed(
  source: Array[U8 val] val)
: String val^

Parameters

Returns


eq

[Source]

fun box eq(
  that: Strings val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: Strings val)
: Bool val

Parameters

Returns