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
When using a Pointer::Appender, somteimes you do not know how much data you're going to append beforehand (only an upper limit). But to continue, you need a slice of the appended data.
I'm proposing to add a method Pointer::Appender#to_slice for that. It returns a slice from the appender start and of the size of appended data. The implementation is trivial:
When using a
Pointer::Appender
, somteimes you do not know how much data you're going to append beforehand (only an upper limit). But to continue, you need a slice of the appended data.I'm proposing to add a method
Pointer::Appender#to_slice
for that. It returns a slice from the appender start and of the size of appended data. The implementation is trivial:There are some use cases in stdlib, where such a method could replace the manual slice creation:
crystal/src/crystal/system/print_error.cr
Lines 21 to 37 in c048851
crystal/src/crystal/system/win32/file_descriptor.cr
Lines 420 to 426 in c048851
The text was updated successfully, but these errors were encountered: