BindgenUniquePtr.h (977B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_BindgenUniquePtr_h 8 #define mozilla_BindgenUniquePtr_h 9 10 #include <memory> 11 12 #include "mozilla/UniquePtr.h" 13 14 namespace mozilla { 15 16 /// <div rustbindgen="true" replaces="mozilla::BindgenUniquePtr"> 17 template <typename T> 18 struct BindgenUniquePtr_Simple { 19 T* mPtr; 20 }; 21 22 template <typename T> 23 class BindgenUniquePtr final : public std::unique_ptr<T, DefaultDelete<T>> { 24 static_assert(alignof(std::unique_ptr<T, DefaultDelete<T>>) == 25 alignof(BindgenUniquePtr_Simple<T>)); 26 static_assert(sizeof(std::unique_ptr<T, DefaultDelete<T>>) == 27 sizeof(BindgenUniquePtr_Simple<T>)); 28 }; 29 30 } // namespace mozilla 31 32 #endif