#pragma once

#include <google/protobuf/stubs/callback.h>
#include <functional>

namespace tinyrpc {

    class TinypbClosure : public google::protobuf::Closure {
    public:
        explicit TinypbClosure(const std::function<void()>& cb) : m_callback(cb){}
        ~TinypbClosure() = default;
        
        void Run() override {
            if(m_callback) {
                m_callback();
            }
        }


    private:
        std::function<void()> m_callback{};



    };

}