Skip to content

Commit

Permalink
Merge pull request #2351 from denizzzka/url_pure_nothrow
Browse files Browse the repository at this point in the history
URL: pure ctors added
  • Loading branch information
s-ludwig authored Aug 24, 2019
2 parents 2ea51dc + 53257db commit 7a03c05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/vibe/core/path.d
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ struct Path {
}

/// Converts the Path back to a string representation using slashes.
string toString()
string toString() pure
const {
if (m_nodes.empty)
return absolute ? "/" : endsWithSlash ? "./" : "";
Expand Down
18 changes: 9 additions & 9 deletions inet/vibe/inet/url.d
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct URL {
}

/// Constructs a new URL object from its components.
this(string schema, string host, ushort port, InetPath path)
this(string schema, string host, ushort port, InetPath path) pure
{
m_schema = schema;
m_host = host;
Expand All @@ -46,29 +46,29 @@ struct URL {
else m_pathString = urlEncode(path.toString(), "/");
}
/// ditto
this(string schema, InetPath path)
this(string schema, InetPath path) pure
{
this(schema, null, 0, path);
}

version (Have_vibe_core) {
/// ditto
this(string schema, string host, ushort port, PosixPath path)
this(string schema, string host, ushort port, PosixPath path) pure
{
this(schema, host, port, cast(InetPath)path);
}
/// ditto
this(string schema, PosixPath path)
this(string schema, PosixPath path) pure
{
this(schema, null, 0, cast(InetPath)path);
}
/// ditto
this(string schema, string host, ushort port, WindowsPath path)
this(string schema, string host, ushort port, WindowsPath path) pure
{
this(schema, host, port, cast(InetPath)path);
}
/// ditto
this(string schema, WindowsPath path)
this(string schema, WindowsPath path) pure
{
this(schema, null, 0, cast(InetPath)path);
}
Expand All @@ -78,7 +78,7 @@ struct URL {
Note that the path must be absolute. On Windows, both, paths starting
with a drive letter and UNC paths are supported.
*/
this(WindowsPath path)
this(WindowsPath path) pure
{
import std.algorithm.iteration : map;
import std.range : chain, only, repeat;
Expand All @@ -100,7 +100,7 @@ struct URL {
} else this("file", host, 0, cast(InetPath)path);
}
/// ditto
this(PosixPath path)
this(PosixPath path) pure
{
enforce(path.absolute, "Only absolute paths can be converted to a URL.");

Expand Down Expand Up @@ -236,7 +236,7 @@ struct URL {
}

/// The host part of the URL (depends on the schema)
@property string host() const { return m_host; }
@property string host() const pure { return m_host; }
/// ditto
@property void host(string v) { m_host = v; }

Expand Down

0 comments on commit 7a03c05

Please sign in to comment.