1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef MOJO_PUBLIC_CPP_BASE_READ_ONLY_BUFFER_MOJOM_TRAITS_H_ 6 #define MOJO_PUBLIC_CPP_BASE_READ_ONLY_BUFFER_MOJOM_TRAITS_H_ 7 8 #include "base/containers/span.h" 9 #include "mojo/public/mojom/base/read_only_buffer.mojom-shared.h" 10 11 namespace mojo { 12 13 template <> 14 struct StructTraits<mojo_base::mojom::ReadOnlyBufferDataView, 15 base::span<const uint8_t>> { 16 static base::span<const uint8_t> buffer(base::span<const uint8_t> input) { 17 return input; 18 } 19 20 static bool Read(mojo_base::mojom::ReadOnlyBufferDataView input, 21 base::span<const uint8_t>* out); 22 }; 23 24 } // namespace mojo 25 26 #endif // MOJO_PUBLIC_CPP_BASE_READ_ONLY_BUFFER_MOJOM_TRAITS_H_ 27