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.
|Algorithms & ranges|
|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.|
|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.|
|See std.container.* for an overview.|
|Modules for reading/writing different data formats.|
|Hash algorithms for verifying data integrity.|
|Date & time|
|std.datetime provides convenient access to date and time
core.time implements low-level time primitives.
|std.exception implements routines related to exceptions. core.exception defines built-in exception types and low-level language hooks required by the compiler.|
|External library bindings|
|Various bindings to external C libraries.|
|I/O & File system|
| std.stdio is the main module for I/O.
std.file is for accessing the operating system's filesystem, and std.path is for manipulating filesystem pathnames in a platform-independent way.
Note that std.stream and std.cstream are older, deprecated modules scheduled to be replaced in the future; new client code should avoid relying on them.
| core.memory provides an API for user code to control the
built-in garbage collector.
std.typecons contains primitives for building scoped variables and reference-counted types.
|These modules provide the primitives for compile-time introspection and metaprogramming.|
|These modules provide primitives for concurrent processing,
multithreading, synchronization, and interacting with operating
core.atomic provides primitives for lock-free concurrent programming.
core.sync.* modules provide low-level concurrent programming building blocks.
core.thread implements multithreading primitives.
|Utilities for networking.|
|These modules provide the standard mathematical functions and
std.bigint provides an arbitrary-precision integer type.
std.complex provides a complex number type.
std.random provides pseudo-random number generators.
|std.functional, along with the lazy algorithms of
std.algorithm, provides utilities for writing functional-style
code in D.
std.signals provides a signal-and-slots framework for event-driven programming.
|Various modules for interacting with the execution environment and
std.getopt implements parsing of command-line arguments.
std.compiler provides compiler information, mainly the compiler vendor string and language version.
std.system provides information about the runtime environment, such as OS type and endianness.
core.cpuid provides information on the capabilities of the CPU the program is running on.
core.memory allows user code to control the built-in garbage collector.
|std.string contains functions that work specifically with
Many string manipulations are special cases of more generic algorithms that work with general arrays, or generic ranges; these are found in std.array and std.algorithm.
D strings are encoded in Unicode; std.uni provides operations that work with Unicode strings in general, while std.utf deals with specific Unicode encodings and conversions between them.
std.format provides printf-style format string formatting, with D's own improvements and extensions.
For manipulating filesystem pathnames, std.path is provided.
std.regex is a very fast library for string matching and substitution using regular expressions.
std.ascii provides routines specific to the ASCII subset of Unicode. Windows-specific character set support is provided by std.windows.charset. Rudimentary support for other string encodings is provided by std.encoding.
|std.conv provides powerful automatic conversions between
built-in types as well as user-defined types that implement
standard conversion primitives.
std.typecons provides various utilities for type construction and compile-time type introspection. It provides facilities for constructing scoped variables and reference-counted types, as well as miscellaneous useful generic types such as tuples and flags.
std.bitmanip provides various bit-level operations, bit arrays, and bit fields. core.bitop provides low-level bit manipulation primitives.
||The core.simd module provides access to SIMD intrinsics in the compiler.|