Added a buffer to construct error messages in without allocation.
This commit is contained in:
parent
f9eb7b2eb1
commit
19f163a150
|
@ -157,6 +157,15 @@ final class Scanner
|
||||||
/// Data for the exception to throw if error_ is true.
|
/// Data for the exception to throw if error_ is true.
|
||||||
ErrorData errorData_;
|
ErrorData errorData_;
|
||||||
|
|
||||||
|
/// Error messages can be built in this buffer without using the GC.
|
||||||
|
///
|
||||||
|
/// ScannerException (MarkedYAMLException) copies string data passed to its
|
||||||
|
/// constructor so it's safe to use slices of this buffer as parameters for
|
||||||
|
/// exceptions that may outlive the Scanner. The GC allocation when creating the
|
||||||
|
/// error message is removed, but the allocation when creating an exception is
|
||||||
|
/// not.
|
||||||
|
char[256] msgBuffer_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///Construct a Scanner using specified Reader.
|
///Construct a Scanner using specified Reader.
|
||||||
this(Reader reader) @safe nothrow
|
this(Reader reader) @safe nothrow
|
||||||
|
|
Loading…
Reference in a new issue