示例#1
0
        Task <AnswerOrCounterquestion> MethodA(DeserializerState d_, CancellationToken cancellationToken_)
        {
            return(Impatient.MaybeTailCall(Impl.MethodA(cancellationToken_), result =>
            {
                var s_ = SerializerState.CreateForRpc <CapnpGen.Issue25A.Result_methodA.WRITER>();
                var r_ = new CapnpGen.Issue25A.Result_methodA {
                    Result = result
                };
                r_.serialize(s_);
                return s_;
            }

                                           ));
        }
        Task <AnswerOrCounterquestion> Save(DeserializerState d_, CancellationToken cancellationToken_)
        {
            using (d_)
            {
                return(Impatient.MaybeTailCall(Impl.Save(CapnpSerializable.Create <Capnp.Persistent <TSturdyRef, TOwner> .SaveParams>(d_), cancellationToken_), r_ =>
                {
                    var s_ = SerializerState.CreateForRpc <Capnp.Persistent <TSturdyRef, TOwner> .SaveResults.WRITER>();
                    r_.serialize(s_);
                    return s_;
                }

                                               ));
            }
        }
示例#3
0
        Task <AnswerOrCounterquestion> Identities(DeserializerState d_, CancellationToken cancellationToken_)
        {
            using (d_)
            {
                return(Impatient.MaybeTailCall(Impl.Identities(cancellationToken_), infos =>
                {
                    var s_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Result_Identities.WRITER>();
                    var r_ = new Mas.Schema.Service.Admin.Result_Identities {
                        Infos = infos
                    };
                    r_.serialize(s_);
                    return s_;
                }

                                               ));
            }
        }
示例#4
0
        Task <AnswerOrCounterquestion> Cultivar(DeserializerState d_, CancellationToken cancellationToken_)
        {
            using (d_)
            {
                return(Impatient.MaybeTailCall(Impl.Cultivar(cancellationToken_), cult =>
                {
                    var s_ = SerializerState.CreateForRpc <Mas.Schema.Crop.Crop.Result_Cultivar.WRITER>();
                    var r_ = new Mas.Schema.Crop.Crop.Result_Cultivar {
                        Cult = cult
                    };
                    r_.serialize(s_);
                    return s_;
                }

                                               ));
            }
        }
示例#5
0
        Task <AnswerOrCounterquestion> Parameters(DeserializerState d_, CancellationToken cancellationToken_)
        {
            using (d_)
            {
                return(Impatient.MaybeTailCall(Impl.Parameters(cancellationToken_), @params =>
                {
                    var s_ = SerializerState.CreateForRpc <Mas.Schema.Crop.Crop.Result_Parameters.WRITER>();
                    var r_ = new Mas.Schema.Crop.Crop.Result_Parameters {
                        Params = @params
                    };
                    r_.serialize(s_);
                    return s_;
                }

                                               ));
            }
        }
示例#6
0
        Task <AnswerOrCounterquestion> Method(DeserializerState d_, CancellationToken cancellationToken_)
        {
            using (d_)
            {
                var in_ = CapnpSerializable.Create <Mas.Rpc.Test.A.Params_Method>(d_);
                return(Impatient.MaybeTailCall(Impl.Method(in_.Param, cancellationToken_), res =>
                {
                    var s_ = SerializerState.CreateForRpc <Mas.Rpc.Test.A.Result_Method.WRITER>();
                    var r_ = new Mas.Rpc.Test.A.Result_Method {
                        Res = res
                    };
                    r_.serialize(s_);
                    return s_;
                }

                                               ));
            }
        }
        Task <AnswerOrCounterquestion> ImportData(DeserializerState d_, CancellationToken cancellationToken_)
        {
            using (d_)
            {
                var in_ = CapnpSerializable.Create <Mas.Schema.Model.Weberest.DWLABImport.Params_ImportData>(d_);
                return(Impatient.MaybeTailCall(Impl.ImportData(in_.Id, in_.Dwla, in_.Dwlb, cancellationToken_), (id, successA, successB) =>
                {
                    var s_ = SerializerState.CreateForRpc <Mas.Schema.Model.Weberest.DWLABImport.Result_ImportData.WRITER>();
                    var r_ = new Mas.Schema.Model.Weberest.DWLABImport.Result_ImportData {
                        Id = id, SuccessA = successA, SuccessB = successB
                    };
                    r_.serialize(s_);
                    return s_;
                }

                                               ));
            }
        }
示例#8
0
        public async Task MaybeTailCall3()
        {
            bool flag = false;

            SerializerState Fn(int a, int b, int c)
            {
                Assert.AreEqual(0, a);
                Assert.AreEqual(1, b);
                Assert.AreEqual(2, c);
                flag = true;
                return(null);
            }

            var t = Task.FromResult((0, 1, 2));
            await Impatient.MaybeTailCall(t, Fn);

            Assert.IsTrue(flag);
        }
示例#9
0
        public async Task MaybeTailCall7()
        {
            bool flag = false;

            SerializerState Fn(int a, int b, int c, int d, int e, int f, int g)
            {
                Assert.AreEqual(0, a);
                Assert.AreEqual(1, b);
                Assert.AreEqual(2, c);
                Assert.AreEqual(3, d);
                Assert.AreEqual(4, e);
                Assert.AreEqual(5, f);
                Assert.AreEqual(6, g);
                flag = true;
                return(null);
            }

            var t = Task.FromResult((0, 1, 2, 3, 4, 5, 6));
            await Impatient.MaybeTailCall(t, Fn);

            Assert.IsTrue(flag);
        }