stdio
FileError: CouldNotOpen, print
Functions: println, print, join, sum, readLine, readFile, writeFile, removeFile, assertFail
enum FileError : Printable
An error reading a file.
CouldNotOpen
CouldNotOpenvoid print(OutputStream& stream)Writes the error as text.
println
void println<T>(T& value)Prints the given value followed by a newline.
void println<T: Copyable>(T value)Prints the given value followed by a newline.
void println(const char[*]? value)Prints the given value followed by a newline.
void println(char[*]? value)Prints the given value followed by a newline.
void println<T: Copyable>(T... args)Prints the given values followed by a newline.
Copyable arguments pass by value so that a char prints as a single character instead of decaying to a C string in print(). Calls with non-Copyable arguments use the borrow overload below.
void println<T: Printable>(T&... args)Prints the given values followed by a newline.
void print<T: Printable + Copyable>(T value)Prints the given value without allocating. Values that aren't copyable must be borrowed explicitly, so printing never moves from them.
void print<T: Printable>(T& value)Prints the given value without allocating.
void print(RepeatIterator<string> repetitions)Prints the repetition without allocating a temporary.
void print<T: Printable>(T* value)Prints the given value without allocating.
void print<T: Printable>(List<T>& list)Prints the given value.
void print<T: Printable>(Slice<T> array)Prints the given value.
void print(const char[*]? cString)Prints the given value without allocating.
void print(char[*]? cString)Prints the given value without allocating.
join
StringBuf join<T: Printable>(Slice<T> array, string separator)Joins the array elements into a string with the given separator.
StringBuf join<T: Printable>(List<T>& list, string separator)Joins the list elements into a string with the given separator.
sum
T sum<T: Addable>(Slice<T> array)Returns the sum of the array elements, aborting on empty arrays.
T sum<T: Addable>(List<T>& list)Returns the sum of the list elements, aborting on empty lists.
readLine
StringBuf readLine()Reads a line from stdin.
readFile
Result<StringBuf, FileError> readFile(string path)Reads the entire file into a string, or returns an error if the file can't be opened.
writeFile
bool writeFile(string path, string content)Writes the string to the named file.
removeFile
bool removeFile(string path)Deletes the named file, returning true on success.
assertFail
void assertFail(const char* message)Prints the message to stderr and aborts.