368 {
370 const char* p = fmt;
371 int auto_index = 0;
372
373 while (*p) {
374 if (*p == '{') {
375 if (*(p + 1) == '{') {
376
378 p += 2;
379 continue;
380 }
381
382 ++p;
383
384
385 int arg_index = -1;
386 if (*p >= '0' && *p <= '9') {
387 arg_index = 0;
388 while (*p >= '0' && *p <= '9') {
389 arg_index = arg_index * 10 + (*p - '0');
390 ++p;
391 }
392 } else {
393 arg_index = auto_index++;
394 }
395
396
398 if (*p == ':') {
399 ++p;
401 }
402
403
404 while (*p && *p != '}') ++p;
405 if (*p == '}') ++p;
406
407
408 if (arg_index >= 0 && arg_index < num_args) {
409 fl::string formatted =
args[arg_index].format(spec);
411 } else {
412 result.append(
"<out_of_range>");
413 }
414 } else if (*p == '}') {
415 if (*(p + 1) == '}') {
416
418 p += 2;
419 } else {
421 }
422 } else {
423
424 const char* next = p;
425 while (*next && *next != '{' && *next != '}') {
426 ++next;
427 }
428 result.append(p,
static_cast<fl::size
>(next - p));
429 p = next;
430 }
431 }
432
434}
expected< T, E > result
Alias for expected (Rust-style naming)