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. Page wiki View or edit the community-maintained wiki page associated with this page.

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
Modules for reading/writing different data formats.
    Data integrity
std.digest.crc
std.digest.digest
std.digest.md
std.digest.ripemd
std.digest.sha
Hash algorithms for verifying data integrity.
    Date & time
std.datetime
core.time
std.datetime provides convenient access to date and time representations.
core.time implements low-level time primitives.
    Exception handling
std.exception
core.exception
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
etc.c.curl
etc.c.sqlite3
etc.c.zlib
Various bindings to external C libraries.
    I/O & File system
std.file
std.path
std.stdio
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.
    Memory management
core.memory
std.typecons
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.
    Metaprogramming
std.traits
std.typecons
std.typetuple
core.demangle
These modules provide the primitives for compile-time introspection and metaprogramming.
    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
These modules provide primitives for concurrent processing, multithreading, synchronization, and interacting with operating system processes.
core.atomic provides primitives for lock-free concurrent programming.
core.sync.* modules provide low-level concurrent programming building blocks.
core.thread implements multithreading primitives.
    Networking
std.socket
std.socketstream
std.net.curl
std.net.isemail
Utilities for networking.
    Numeric
std.bigint
std.complex
std.math
std.mathspecial
std.numeric
std.random
These modules provide the standard mathematical functions and numerical algorithms.
std.bigint provides an arbitrary-precision integer type.
std.complex provides a complex number type.
std.random provides pseudo-random number generators.
    Paradigms
std.functional
std.algorithm
std.signals
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.
    Runtime utilities
std.getopt
std.compiler
std.system
core.cpuid
core.memory
Various modules for interacting with the execution environment and compiler.
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.
    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
std.string contains functions that work specifically with strings.
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.
    Type manipulations
std.conv
std.typecons
std.bitmanip
core.bitop
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.
    Vector programming
core.simd
The core.simd module provides access to SIMD intrinsics in the compiler.