You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StringBuffer, BytesBuffer mutable alternatives for String, Bytes
Can be converted to const string or bytes by freezing
to_string(io) method declared on Value class
can be overridden to implement custom to_string behaviour
receives an IO object to write string contents to
IO is an interface implementing basic read / write access to "stuff"
io is backed by a string buffer
Base Value class contains to_string() method with no io, allocating the string buffer
interfaceIO{functo_string{constbuf=StringBuffer.new()to_string(buf)buf.freeze()}}classPerson{propertynamepropertyagefuncto_string(io){io<<"Person name={name} age={age}"io}}constp1=Person("alice",24)constp2=Person("bob",22)p1.to_string()// Person name=alice age=24p2.to_string()// Person name=bob age=22
The text was updated successfully, but these errors were encountered:
StringBuffer
,BytesBuffer
mutable alternatives forString
,Bytes
to_string(io)
method declared onValue
classIO
object to write string contents toIO
is an interface implementing basic read / write access to "stuff"io
is backed by a string bufferValue
class containsto_string()
method with no io, allocating the string bufferThe text was updated successfully, but these errors were encountered: