// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "fuchsia/base/string_util.h" namespace cr_fuchsia { std::vector StringToBytes(base::StringPiece str) { const uint8_t* raw_data = reinterpret_cast(str.data()); return std::vector(raw_data, raw_data + str.length()); } base::StringPiece BytesAsString(const std::vector& bytes) { return base::StringPiece(reinterpret_cast(bytes.data()), bytes.size()); } } // namespace cr_fuchsia