summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2017-02-10 19:19:37 +0100
committerEugen Wissner <belka@caraus.de>2017-02-10 19:19:37 +0100
commitb74e5aa4ee57af17450d7ef63547002d99dffdbe (patch)
tree9670faac3e6c273f7649d06c537c0db586c1ef7b
parent44ac15ab78c3ee66e2705309245097ff0d78b8b0 (diff)
downloadtanya-b74e5aa4ee57af17450d7ef63547002d99dffdbe.tar.gz
Make event loop implementations final
-rw-r--r--source/tanya/async/event/epoll.d2
-rw-r--r--source/tanya/async/event/iocp.d4
-rw-r--r--source/tanya/async/event/kqueue.d2
-rw-r--r--source/tanya/async/event/selector.d2
-rw-r--r--source/tanya/container/string.d77
5 files changed, 5 insertions, 82 deletions
diff --git a/source/tanya/async/event/epoll.d b/source/tanya/async/event/epoll.d
index bcc375e..998ad18 100644
--- a/source/tanya/async/event/epoll.d
+++ b/source/tanya/async/event/epoll.d
@@ -34,7 +34,7 @@ extern (C) nothrow @nogc
int epoll_wait (int epfd, epoll_event *events, int maxevents, int timeout);
}
-class EpollLoop : SelectorLoop
+final class EpollLoop : SelectorLoop
{
protected int fd;
private Vector!epoll_event events;
diff --git a/source/tanya/async/event/iocp.d b/source/tanya/async/event/iocp.d
index 2194304..31e57c8 100644
--- a/source/tanya/async/event/iocp.d
+++ b/source/tanya/async/event/iocp.d
@@ -26,7 +26,7 @@ import core.sys.windows.winbase;
import core.sys.windows.windef;
import core.sys.windows.winsock2;
-class IOCPStreamTransport : StreamTransport
+final class IOCPStreamTransport : StreamTransport
{
private WriteBuffer!ubyte input;
@@ -106,7 +106,7 @@ class IOCPStreamTransport : StreamTransport
}
}
-class IOCPLoop : Loop
+final class IOCPLoop : Loop
{
protected HANDLE completionPort;
diff --git a/source/tanya/async/event/kqueue.d b/source/tanya/async/event/kqueue.d
index 0e448af..e52a737 100644
--- a/source/tanya/async/event/kqueue.d
+++ b/source/tanya/async/event/kqueue.d
@@ -113,7 +113,7 @@ extern(C) int kevent(int kq, const kevent_t *changelist, int nchanges,
kevent_t *eventlist, int nevents, const timespec *timeout)
nothrow @nogc;
-class KqueueLoop : SelectorLoop
+final class KqueueLoop : SelectorLoop
{
protected int fd;
private Vector!kevent_t events;
diff --git a/source/tanya/async/event/selector.d b/source/tanya/async/event/selector.d
index 3aa105c..83a9fce 100644
--- a/source/tanya/async/event/selector.d
+++ b/source/tanya/async/event/selector.d
@@ -25,7 +25,7 @@ import tanya.network.socket;
/**
* Transport for stream sockets.
*/
-class SelectorStreamTransport : IOWatcher, StreamTransport
+final class SelectorStreamTransport : IOWatcher, StreamTransport
{
/// Input buffer.
package WriteBuffer!ubyte input;
diff --git a/source/tanya/container/string.d b/source/tanya/container/string.d
deleted file mode 100644
index 05f9e70..0000000
--- a/source/tanya/container/string.d
+++ /dev/null
@@ -1,77 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * Copyright: Eugene Wissner 2016-2017.
- * License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
- * Mozilla Public License, v. 2.0).
- * Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
- */
-module tanya.container.string;
-
-import core.exception;
-import core.stdc.string;
-import tanya.memory;
-
-/**
- * UTF-8 string.
- */
-struct String
-{
- private char[] data;
- private size_t length_;
-
- invariant
- {
- assert(length_ <= data.length);
- }
-
- /// Ditto.
- this(const(char)[] str, shared Allocator allocator = defaultAllocator)
- nothrow @trusted @nogc
- {
- this(allocator);
-
- data = cast(char[]) allocator.allocate(str.length);
- if (str.length > 0 && data is null)
- {
- onOutOfMemoryErrorNoGC();
- }
- memcpy(data.ptr, str.ptr, str.length);
- }
-
- /// Ditto.
- this(const(wchar)[] str, shared Allocator allocator = defaultAllocator)
- nothrow @trusted @nogc
- {
- this(allocator);
-
- }
-
- /// Ditto.
- this(const(dchar)[] str, shared Allocator allocator = defaultAllocator)
- nothrow @trusted @nogc
- {
- this(allocator);
-
- }
-
- /// Ditto.
- this(shared Allocator allocator) pure nothrow @safe @nogc
- in
- {
- assert(allocator !is null);
- }
- body
- {
- allocator_ = allocator;
- }
-
- ~this() nothrow @trusted @nogc
- {
- allocator.deallocate(data);
- }
-
- mixin DefaultAllocator;
-}