annotate win64-msvc/include/capnp/serialize-async.h @ 63:0f2d93caa50c

Update Win64 capnp builds to v0.6
author Chris Cannam
date Mon, 22 May 2017 18:56:49 +0100
parents d93140aac40b
children
rev   line source
Chris@63 1 // Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors
Chris@63 2 // Licensed under the MIT License:
Chris@63 3 //
Chris@63 4 // Permission is hereby granted, free of charge, to any person obtaining a copy
Chris@63 5 // of this software and associated documentation files (the "Software"), to deal
Chris@63 6 // in the Software without restriction, including without limitation the rights
Chris@63 7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Chris@63 8 // copies of the Software, and to permit persons to whom the Software is
Chris@63 9 // furnished to do so, subject to the following conditions:
Chris@63 10 //
Chris@63 11 // The above copyright notice and this permission notice shall be included in
Chris@63 12 // all copies or substantial portions of the Software.
Chris@63 13 //
Chris@63 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Chris@63 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Chris@63 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Chris@63 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Chris@63 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Chris@63 19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Chris@63 20 // THE SOFTWARE.
Chris@63 21
Chris@63 22 #ifndef CAPNP_SERIALIZE_ASYNC_H_
Chris@63 23 #define CAPNP_SERIALIZE_ASYNC_H_
Chris@63 24
Chris@63 25 #if defined(__GNUC__) && !defined(CAPNP_HEADER_WARNINGS)
Chris@63 26 #pragma GCC system_header
Chris@63 27 #endif
Chris@63 28
Chris@63 29 #include <kj/async-io.h>
Chris@63 30 #include "message.h"
Chris@63 31
Chris@63 32 namespace capnp {
Chris@63 33
Chris@63 34 kj::Promise<kj::Own<MessageReader>> readMessage(
Chris@63 35 kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(),
Chris@63 36 kj::ArrayPtr<word> scratchSpace = nullptr);
Chris@63 37 // Read a message asynchronously.
Chris@63 38 //
Chris@63 39 // `input` must remain valid until the returned promise resolves (or is canceled).
Chris@63 40 //
Chris@63 41 // `scratchSpace`, if provided, must remain valid until the returned MessageReader is destroyed.
Chris@63 42
Chris@63 43 kj::Promise<kj::Maybe<kj::Own<MessageReader>>> tryReadMessage(
Chris@63 44 kj::AsyncInputStream& input, ReaderOptions options = ReaderOptions(),
Chris@63 45 kj::ArrayPtr<word> scratchSpace = nullptr);
Chris@63 46 // Like `readMessage` but returns null on EOF.
Chris@63 47
Chris@63 48 kj::Promise<void> writeMessage(kj::AsyncOutputStream& output,
Chris@63 49 kj::ArrayPtr<const kj::ArrayPtr<const word>> segments)
Chris@63 50 KJ_WARN_UNUSED_RESULT;
Chris@63 51 kj::Promise<void> writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder)
Chris@63 52 KJ_WARN_UNUSED_RESULT;
Chris@63 53 // Write asynchronously. The parameters must remain valid until the returned promise resolves.
Chris@63 54
Chris@63 55 // =======================================================================================
Chris@63 56 // inline implementation details
Chris@63 57
Chris@63 58 inline kj::Promise<void> writeMessage(kj::AsyncOutputStream& output, MessageBuilder& builder) {
Chris@63 59 return writeMessage(output, builder.getSegmentsForOutput());
Chris@63 60 }
Chris@63 61
Chris@63 62 } // namespace capnp
Chris@63 63
Chris@63 64 #endif // CAPNP_SERIALIZE_ASYNC_H_