// WARNING: This file is machine generated by fidlgen.

// fidl_experiment = output_index_json

#pragma once

#include <fidl/test.drivertwoway/cpp/natural_types.h>
#include <lib/fidl/cpp/natural_ostream.h>
#include <lib/fidl_driver/cpp/natural_ostream.h>

#include <iostream>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"

template <>
struct fidl::ostream::Formatter<::test_drivertwoway::TwoWayAddRequest> {
  static std::ostream& Format(std::ostream& os, const ::test_drivertwoway::TwoWayAddRequest& value);
};
template <>
struct fidl::ostream::Formatter<::test_drivertwoway::TwoWayAddResponse> {
  static std::ostream& Format(std::ostream& os, const ::test_drivertwoway::TwoWayAddResponse& value);
};

namespace test_drivertwoway {

std::ostream& operator<<(std::ostream& os, const ::test_drivertwoway::TwoWayAddRequest& value);

std::ostream& operator<<(std::ostream& os, const ::test_drivertwoway::TwoWayAddResponse& value);

}  // namespace test_drivertwoway

#ifdef __Fuchsia__

template <>
struct fidl::ostream::Formatter<::fdf::ClientEnd<::test_drivertwoway::TwoWay>> {
  static std::ostream& Format(std::ostream& os, const ::fdf::ClientEnd<::test_drivertwoway::TwoWay>& value) {
    return os << "ClientEnd<" << "test_drivertwoway::TwoWay" << ">(" << value.channel().get() << ")";
  }
};

template <>
struct fidl::ostream::Formatter<::fdf::ServerEnd<::test_drivertwoway::TwoWay>> {
  static std::ostream& Format(std::ostream& os, const ::fdf::ServerEnd<::test_drivertwoway::TwoWay>& value) {
    return os << "ServerEnd<" << "test_drivertwoway::TwoWay" << ">(" << value.channel().get() << ")";
  }
};

namespace fdf {

inline std::ostream& operator<<(std::ostream& os, const ::fdf::ClientEnd<::test_drivertwoway::TwoWay>& value) {
  return fidl::ostream::Formatter<::fdf::ClientEnd<::test_drivertwoway::TwoWay>>::Format(os, value);
}

inline std::ostream& operator<<(std::ostream& os, const ::fdf::ServerEnd<::test_drivertwoway::TwoWay>& value) {
  return fidl::ostream::Formatter<::fdf::ServerEnd<::test_drivertwoway::TwoWay>>::Format(os, value);
}
}  // namespace fdf

#endif  // __Fuchsia__

#pragma clang diagnostic pop
