[][src]Module genco::lang::dart

Specialization for Dart code generation.

String Quoting in Dart

Since Java uses UTF-16 internally, string quoting for high unicode characters is done through surrogate pairs, as seen with the 😊 below.

use genco::prelude::*;

let toks: dart::Tokens = quote!("start π 😊 \n \x7f ÿ $ \\ end");
assert_eq!("\"start π 😊 \\n \\x7f ÿ \\$ \\\\ end\"", toks.to_string()?);

String Interpolation in Dart

Strings can be interpolated in Dart, by using the special $_(<string>) escape sequence.

use genco::prelude::*;

let toks: dart::Tokens = quote!(#_(  Hello: $var  ));
assert_eq!("\"  Hello: $var  \"", toks.to_string()?);

let toks: dart::Tokens = quote!(#_(  Hello: $(a + b)  ));
assert_eq!("\"  Hello: ${a + b}  \"", toks.to_string()?);

Structs

Config

Config data for Dart formatting.

Dart

Language specialization for Dart.

DocComment

Format a doc comment where each line is preceeded by ///.

Format

Format state for Dart.

Import

The import of a Dart type import "dart:math";.

Enums

Any

A type-erased language item capable of holding any kind.

Functions

doc_comment

Format a doc comment where each line is preceeded by ///.

import

The import of a Dart type import "dart:math";.

Type Definitions

Tokens

Tokens container specialization for Dart.