Bug 1698786: part 2) Change some compile-time dependent `printf`s to `MOZ_LOG` in...
[gecko.git] / layout / style / RustCell.h
blob631c6ebb0e33ed4b58b62143f70e14ed199bad6e
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/. */
7 /* an object with the same layout as a Rust std::cell::Cell<T> */
9 #ifndef mozilla_RustCell_h
10 #define mozilla_RustCell_h
12 namespace mozilla {
14 /**
15 * Object with the same layout as std::cell::Cell<T>.
17 * ServoBindings.toml defines a mapping so that generated bindings use a
18 * real std::cell::Cell<T>.
20 * Note that while the layout matches, this doesn't have the same ABI as a
21 * std::cell::Cell<T>, so values of this type can't be passed over FFI
22 * functions.
24 template <typename T>
25 class RustCell {
26 public:
27 RustCell() : mValue() {}
29 T Get() const { return mValue; }
31 private:
32 T mValue;
35 } // namespace mozilla
37 #endif // mozilla_RustCell_h