vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

Struct GenericPath

Provides a common interface to operate on paths of various kinds.

struct GenericPath(F) ;

Constructors

NameDescription
this (p) Constructs a path from its string representation.
this (segment) Constructs a path from a single path segment.
this (segments) Constructs a path from an input range of Segments.

Fields

NameTypeDescription
m_path string

Properties

NameTypeDescription
absolute[get] boolTests if the path is absolute.
byPrefix[get] autoIterates over the path by segment, each time returning the sub path leading to that segment.
bySegment[get] GenericPath.PathRangeIterates over the path by Segment.
bySegment2[get] autoIterates over the individual segments of the path.
empty[get] boolTests if the path is represented by an empty string.
endsWithSlash[get, set] boolDetermines whether the path ends with a path separator (i.e. represents a folder specifically).
head[get] GenericPath.SegmentReturns the trailing segment of the path.
head2[get] GenericPath.Segment2Returns the trailing segment of the path.

Methods

NameDescription
fromString (p) Constructs a path from its string representation.
fromTrustedString (p) Constructs a path from its string representation, skipping the validation.
hasParentPath () Determines if the parentPath property is valid.
isSeparator (ch) Tests if a certain character is a path segment separator.
normalize () Removes any redundant path segments and replaces all separators by the default one.
opBinary (subpath) Concatenates two paths.
opCast () Converts the path to a different path format.
opEquals (other) Compares two path objects.
opOpAssign (op) Appends a relative path to this path.
parentPath () Returns a prefix of this path, where the last segment has been dropped.
startsWith (prefix) Tests whether the given path is a prefix of this path.
toHash () Computes a hash sum, enabling storage within associative arrays.
toString () Returns the string representation of the path.

Inner structs

NameDescription
PathRange Represents a path as an forward range of Segments.
Segment A single path segment.
Segment2 A single path segment.

Aliases

NameDescription
Format
Authors

Sönke Ludwig

Copyright

© 2012-2019 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.