free_to_bytes


Description:

[ Version ( since = "2.34" ) ]
public static Bytes free_to_bytes (owned StringBuilder str)

Transfers ownership of the contents of this to a newly allocated Bytes.

The StringBuilder structure itself is deallocated, and it is therefore invalid to use this after invoking this function.

Note that while StringBuilder ensures that its buffer always has a trailing nul character (not reflected in its "len"), the returned Bytes does not include this extra nul; i.e. it has length exactly equal to the "len" member.

Parameters:

string

a StringBuilder

Returns:

A newly allocated Bytes containing contents of this ; this itself is freed