pw_kvs: Move span traits outside of public header

Change-Id: I1cabd7b8121cf227189d8aa4d86e8a036866c7ed
diff --git a/pw_kvs/BUILD b/pw_kvs/BUILD
index 0bb2120..01b63ea 100644
--- a/pw_kvs/BUILD
+++ b/pw_kvs/BUILD
@@ -34,6 +34,7 @@
         "public/pw_kvs/internal/hash.h",
         "public/pw_kvs/internal/key_descriptor.h",
         "public/pw_kvs/internal/sector_descriptor.h",
+        "public/pw_kvs/internal/span_traits.h",
         "pw_kvs_private/macros.h",
     ],
     hdrs = [
diff --git a/pw_kvs/BUILD.gn b/pw_kvs/BUILD.gn
index 237ec7f..5f899b3 100644
--- a/pw_kvs/BUILD.gn
+++ b/pw_kvs/BUILD.gn
@@ -39,6 +39,7 @@
     "public/pw_kvs/internal/hash.h",
     "public/pw_kvs/internal/key_descriptor.h",
     "public/pw_kvs/internal/sector_descriptor.h",
+    "public/pw_kvs/internal/span_traits.h",
     "pw_kvs_private/macros.h",
   ]
   sources += public
diff --git a/pw_kvs/public/pw_kvs/internal/span_traits.h b/pw_kvs/public/pw_kvs/internal/span_traits.h
new file mode 100644
index 0000000..4a0bd3a
--- /dev/null
+++ b/pw_kvs/public/pw_kvs/internal/span_traits.h
@@ -0,0 +1,39 @@
+// Copyright 2020 The Pigweed Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+#pragma once
+
+#include <type_traits>
+
+namespace pw::kvs {
+
+namespace internal {
+template <typename T, typename = decltype(span(std::declval<T>()))>
+constexpr bool ConvertsToSpan(int) {
+  return true;
+}
+
+// If the expression span(T) fails, then the type can't be converted to a span.
+template <typename T>
+constexpr bool ConvertsToSpan(...) {
+  return false;
+}
+
+}  // namespace internal
+
+// Traits class to detect if the type is a span.
+template <typename T>
+using ConvertsToSpan =
+    std::bool_constant<internal::ConvertsToSpan<std::remove_reference_t<T>>(0)>;
+
+}  // namespace pw::kvs
diff --git a/pw_kvs/public/pw_kvs/key_value_store.h b/pw_kvs/public/pw_kvs/key_value_store.h
index de0d646..ed797b5 100644
--- a/pw_kvs/public/pw_kvs/key_value_store.h
+++ b/pw_kvs/public/pw_kvs/key_value_store.h
@@ -26,31 +26,12 @@
 #include "pw_kvs/internal/entry.h"
 #include "pw_kvs/internal/key_descriptor.h"
 #include "pw_kvs/internal/sector_descriptor.h"
+#include "pw_kvs/internal/span_traits.h"
 #include "pw_span/span.h"
 #include "pw_status/status.h"
 #include "pw_status/status_with_size.h"
 
 namespace pw::kvs {
-namespace internal {
-
-template <typename T, typename = decltype(span(std::declval<T>()))>
-constexpr bool ConvertsToSpan(int) {
-  return true;
-}
-
-// If the expression span(T) fails, then the type can't be converted to a span.
-template <typename T>
-constexpr bool ConvertsToSpan(...) {
-  return false;
-}
-
-}  // namespace internal
-
-// Traits class to detect if the type is a span. This is used to ensure that the
-// correct overload of the Put function is selected.
-template <typename T>
-using ConvertsToSpan =
-    std::bool_constant<internal::ConvertsToSpan<std::remove_reference_t<T>>(0)>;
 
 // TODO: Select the appropriate defaults, add descriptions.
 struct Options {