Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Phobos Runtime Library
Phobos is the standard runtime library that comes with the D language compiler.
Generally, the std namespace is used for the main modules in the Phobos standard library. The etc namespace is used for external C/C++ library bindings. The core namespace is used for low-level D runtime functions.
The following table is a quick reference guide for which Phobos modules to use for a given category of functionality. Note that some modules may appear in more than one category, as some Phobos modules are quite generic and can be applied in a variety of situations.
Modules | Description |
---|---|
Algorithms & ranges | |
std.algorithm std.range std.range.primitives std.range.interfaces |
Generic algorithms that work with ranges of any type, including strings, arrays, and other kinds of sequentially-accessed data. Algorithms include searching, comparison, iteration, sorting, set operations, and mutation. |
Array manipulation | |
std.array std.algorithm |
Convenient operations commonly used with built-in arrays. Note that many common array operations are subsets of more generic algorithms that work with arbitrary ranges, so they are found in std.algorithm. |
Containers | |
std.container.array std.container.binaryheap std.container.dlist std.container.rbtree std.container.slist |
See std.container.* for an overview. |
Data formats | |
std.base64 std.csv std.json std.xml std.zip std.zlib |
Encoding / decoding Base64 format Read Comma Separated Values and its variants from an input range of dchar Read/write data in JSON format Read/write data in XML format Read/write data in the ZIP archive format Compress/decompress data using the zlib library |
Data integrity | |
std.digest.crc std.digest.digest std.digest.md std.digest.ripemd std.digest.sha |
Cyclic Redundancy Check (32-bit) implementation Compute digests such as md5, sha1 and crc32 Compute MD5 hash of arbitrary data Compute RIPEMD-160 hash of arbitrary data Compute SHA1 and SHA2 hashes of arbitrary data |
Date & time | |
std.datetime core.time |
Provides convenient access to date and time representations. Implements low-level time primitives. |
Exception handling | |
std.exception core.exception |
Implements routines related to exceptions. Defines built-in exception types and low-level language hooks required by the compiler. |
External library bindings | |
etc.c.curl etc.c.sqlite3 etc.c.zlib |
Various bindings to external C libraries.
Interface to libcurl C library. Interface to SQLite C library. Interface to zlib D library. |
I/O & File system | |
std.file std.path std.stdio |
Manipulate files and directories. Manipulate strings that represent filesystem paths. Perform buffered I/O. |
Memory management | |
core.memory std.typecons |
Control the built-in garbage collector. Build scoped variables and reference-counted types. |
Metaprogramming | |
std.traits std.typecons std.typetuple core.demangle |
Extract information about types and symbols at compile time. Construct new, useful general purpose types. Construct and manipulate type tuples (aka type lists). Convert mangled D symbol identifiers to source representation. |
Multitasking | |
std.concurrency std.parallelism std.process core.atomic core.sync.barrier core.sync.condition core.sync.exception core.sync.mutex core.sync.rwmutex core.sync.semaphore core.thread |
Low level messaging API for threads. High level primitives for SMP parallelism. Starting and manipulating processes. Basic support for lock-free concurrent programming. Synchronize the progress of a group of threads. Synchronized condition checking. Base class for synchronization exceptions. Mutex for mutually exclusive access. Shared read access and mutually exclusive write access. General use synchronization semaphore. Thread creation and management. |
Networking | |
std.socket std.net.curl std.net.isemail |
Socket primitives. Stream for a blocking, connected Socket. Networking client functionality as provided by libcurl. Validates an email address according to RFCs 5321, 5322 and others. |
Numeric | |
std.bigint std.complex std.math std.mathspecial std.numeric std.random |
An arbitrary-precision integer type. A complex number type. Elementary mathematical functions (powers, roots, trigonometry), low-level floating-point operations. Families of transcendental functions. Floating point numerics functions. Pseudo-random number generators. |
Paradigms | |
std.functional std.algorithm std.signals |
Functions that manipulate other functions. Generic algorithms for processing sequences. Signal-and-slots framework for event-driven programming. |
Runtime utilities | |
std.getopt std.compiler std.system core.cpuid core.memory |
Parsing of command-line arguments. Host compiler vendor string and language version. Runtime environment, such as OS type and endianness. Capabilities of the CPU the program is running on. Control the built-in garbage collector. |
String manipulation | |
std.string std.array std.algorithm std.uni std.utf std.format std.path std.regex std.ascii std.encoding std.windows.charset |
Algorithms that work specifically with strings. Manipulate builtin arrays. Generic algorithms for processing sequences. Fundamental Unicode algorithms and data structures. Encode and decode UTF-8, UTF-16 and UTF-32 strings. Format data into strings. Manipulate strings that represent filesystem paths. Regular expressions. Routines specific to the ASCII subset of Unicode. Handle and transcode between various text encodings. Windows specific character set support. |
Type manipulations | |
std.conv std.typecons std.bitmanip core.bitop |
Convert types from one type to another. Type constructors for scoped variables, ref counted types, etc. High level bit level manipulation, bit arrays, bit fields. Low level bit manipulation. |
Vector programming | |
core.simd |
SIMD intrinsics |