Move all cbindgen generated code into

sixtyfps::cbindgen_private

Having private in the name makes it clear that this is ... private,
and cbindgen helps remember that it's generated.
This commit is contained in:
Simon Hausmann 2020-08-25 15:29:48 +02:00
parent 2fa953ce8a
commit 14fe897086
12 changed files with 108 additions and 108 deletions

View file

@ -16,7 +16,7 @@ LICENSE END */
#include <vector> #include <vector>
#include <memory> #include <memory>
namespace sixtyfps::internal { namespace sixtyfps::cbindgen_private {
// Workaround https://github.com/eqrion/cbindgen/issues/43 // Workaround https://github.com/eqrion/cbindgen/issues/43
struct ComponentVTable; struct ComponentVTable;
struct ItemVTable; struct ItemVTable;
@ -27,31 +27,31 @@ struct ItemVTable;
namespace sixtyfps { namespace sixtyfps {
extern "C" { extern "C" {
extern const internal::ItemVTable RectangleVTable; extern const cbindgen_private::ItemVTable RectangleVTable;
extern const internal::ItemVTable BorderRectangleVTable; extern const cbindgen_private::ItemVTable BorderRectangleVTable;
extern const internal::ItemVTable TextVTable; extern const cbindgen_private::ItemVTable TextVTable;
extern const internal::ItemVTable TouchAreaVTable; extern const cbindgen_private::ItemVTable TouchAreaVTable;
extern const internal::ItemVTable ImageVTable; extern const cbindgen_private::ItemVTable ImageVTable;
extern const internal::ItemVTable PathVTable; extern const cbindgen_private::ItemVTable PathVTable;
extern const internal::ItemVTable FlickableVTable; extern const cbindgen_private::ItemVTable FlickableVTable;
extern const internal::ItemVTable WindowVTable; extern const cbindgen_private::ItemVTable WindowVTable;
} }
// Bring opaque structure in scope // Bring opaque structure in scope
using internal::ComponentVTable; using cbindgen_private::ComponentVTable;
using ItemTreeNode = internal::ItemTreeNode<uint8_t>; using ItemTreeNode = cbindgen_private::ItemTreeNode<uint8_t>;
using ComponentRef = VRef<ComponentVTable>; using ComponentRef = VRef<ComponentVTable>;
using ItemVisitorRefMut = VRefMut<internal::ItemVisitorVTable>; using ItemVisitorRefMut = VRefMut<cbindgen_private::ItemVisitorVTable>;
using internal::TraversalOrder; using cbindgen_private::TraversalOrder;
using internal::EasingCurve; using cbindgen_private::EasingCurve;
using internal::TextHorizontalAlignment; using cbindgen_private::TextHorizontalAlignment;
using internal::TextVerticalAlignment; using cbindgen_private::TextVerticalAlignment;
using internal::Slice; using cbindgen_private::Slice;
struct ComponentWindow struct ComponentWindow
{ {
ComponentWindow() { internal::sixtyfps_component_window_gl_renderer_init(&inner); } ComponentWindow() { cbindgen_private::sixtyfps_component_window_gl_renderer_init(&inner); }
~ComponentWindow() { internal::sixtyfps_component_window_drop(&inner); } ~ComponentWindow() { cbindgen_private::sixtyfps_component_window_drop(&inner); }
ComponentWindow(const ComponentWindow &) = delete; ComponentWindow(const ComponentWindow &) = delete;
ComponentWindow(ComponentWindow &&) = delete; ComponentWindow(ComponentWindow &&) = delete;
ComponentWindow &operator=(const ComponentWindow &) = delete; ComponentWindow &operator=(const ComponentWindow &) = delete;
@ -72,25 +72,25 @@ struct ComponentWindow
template<typename Component> template<typename Component>
void free_graphics_resources(Component *c) const void free_graphics_resources(Component *c) const
{ {
internal::sixtyfps_component_window_free_graphics_resources( cbindgen_private::sixtyfps_component_window_free_graphics_resources(
&inner, VRef<ComponentVTable> { &Component::component_type, c }); &inner, VRef<ComponentVTable> { &Component::component_type, c });
} }
private: private:
internal::ComponentWindowOpaque inner; cbindgen_private::ComponentWindowOpaque inner;
}; };
using internal::BorderRectangle; using cbindgen_private::BorderRectangle;
using internal::Flickable; using cbindgen_private::Flickable;
using internal::Image; using cbindgen_private::Image;
using internal::Path; using cbindgen_private::Path;
using internal::Rectangle; using cbindgen_private::Rectangle;
using internal::Text; using cbindgen_private::Text;
using internal::TouchArea; using cbindgen_private::TouchArea;
using internal::Window; using cbindgen_private::Window;
constexpr inline ItemTreeNode make_item_node(std::uintptr_t offset, constexpr inline ItemTreeNode make_item_node(std::uintptr_t offset,
const internal::ItemVTable *vtable, const cbindgen_private::ItemVTable *vtable,
uint32_t child_count, uint32_t child_index) uint32_t child_count, uint32_t child_index)
{ {
return ItemTreeNode { ItemTreeNode::Item_Body { return ItemTreeNode { ItemTreeNode::Item_Body {
@ -103,9 +103,9 @@ constexpr inline ItemTreeNode make_dyn_node(std::uintptr_t offset)
ItemTreeNode::Tag::DynamicTree, offset } }; ItemTreeNode::Tag::DynamicTree, offset } };
} }
using internal::sixtyfps_visit_item_tree; using cbindgen_private::sixtyfps_visit_item_tree;
using internal::MouseEvent; using cbindgen_private::MouseEvent;
using internal::InputEventResult; using cbindgen_private::InputEventResult;
template<typename GetDynamic> template<typename GetDynamic>
inline InputEventResult process_input_event( inline InputEventResult process_input_event(
ComponentRef component, int64_t &mouse_grabber, MouseEvent mouse_event, ComponentRef component, int64_t &mouse_grabber, MouseEvent mouse_event,
@ -114,7 +114,7 @@ inline InputEventResult process_input_event(
if (mouse_grabber != -1) { if (mouse_grabber != -1) {
auto item_index = mouse_grabber & 0xffffffff; auto item_index = mouse_grabber & 0xffffffff;
auto rep_index = mouse_grabber >> 32; auto rep_index = mouse_grabber >> 32;
auto offset = internal::sixtyfps_item_offset(component, tree, item_index); auto offset = cbindgen_private::sixtyfps_item_offset(component, tree, item_index);
mouse_event.pos = { mouse_event.pos.x - offset.x , mouse_event.pos.y - offset.y }; mouse_event.pos = { mouse_event.pos.x - offset.x , mouse_event.pos.y - offset.y };
const auto &item_node = tree.ptr[item_index]; const auto &item_node = tree.ptr[item_index];
InputEventResult result = InputEventResult::EventIgnored; InputEventResult result = InputEventResult::EventIgnored;
@ -136,18 +136,18 @@ inline InputEventResult process_input_event(
} }
return result; return result;
} else { } else {
return internal::sixtyfps_process_ungrabbed_mouse_event(component, mouse_event, &mouse_grabber); return cbindgen_private::sixtyfps_process_ungrabbed_mouse_event(component, mouse_event, &mouse_grabber);
} }
} }
// layouts: // layouts:
using internal::grid_layout_info; using cbindgen_private::grid_layout_info;
using internal::GridLayoutCellData; using cbindgen_private::GridLayoutCellData;
using internal::GridLayoutData; using cbindgen_private::GridLayoutData;
using internal::PathLayoutData; using cbindgen_private::PathLayoutData;
using internal::PathLayoutItemData; using cbindgen_private::PathLayoutItemData;
using internal::solve_grid_layout; using cbindgen_private::solve_grid_layout;
using internal::solve_path_layout; using cbindgen_private::solve_path_layout;
// models // models

View file

@ -38,22 +38,22 @@ public:
friend bool operator!=(const Color &lhs, const Color &rhs) { return !(lhs == rhs); } friend bool operator!=(const Color &lhs, const Color &rhs) { return !(lhs == rhs); }
private: private:
internal::types::Color inner; cbindgen_private::types::Color inner;
}; };
template<> template<>
void Property<Color>::set_animated_value(const Color &new_value, void Property<Color>::set_animated_value(const Color &new_value,
const internal::PropertyAnimation &animation_data) const cbindgen_private::PropertyAnimation &animation_data)
{ {
internal::sixtyfps_property_set_animated_value_color(&inner, value, new_value, &animation_data); cbindgen_private::sixtyfps_property_set_animated_value_color(&inner, value, new_value, &animation_data);
} }
template<> template<>
template<typename F> template<typename F>
void Property<Color>::set_animated_binding(F binding, void Property<Color>::set_animated_binding(F binding,
const internal::PropertyAnimation &animation_data) const cbindgen_private::PropertyAnimation &animation_data)
{ {
internal::sixtyfps_property_set_animated_binding_color( cbindgen_private::sixtyfps_property_set_animated_binding_color(
&inner, &inner,
[](void *user_data, Color *value) { [](void *user_data, Color *value) {
*reinterpret_cast<Color *>(value) = (*reinterpret_cast<F *>(user_data))(); *reinterpret_cast<Color *>(value) = (*reinterpret_cast<F *>(user_data))();

View file

@ -15,16 +15,16 @@ LICENSE END */
namespace sixtyfps { namespace sixtyfps {
using internal::types::PathArcTo; using cbindgen_private::types::PathArcTo;
using internal::types::PathElement; using cbindgen_private::types::PathElement;
using internal::types::PathEvent; using cbindgen_private::types::PathEvent;
using internal::types::PathLineTo; using cbindgen_private::types::PathLineTo;
using internal::types::Point; using cbindgen_private::types::Point;
struct PathData struct PathData
{ {
public: public:
using Tag = internal::types::PathData::Tag; using Tag = cbindgen_private::types::PathData::Tag;
PathData() : data(Data::None()) { } PathData() : data(Data::None()) { }
PathData(const PathElement *firstElement, size_t count) PathData(const PathElement *firstElement, size_t count)
@ -47,7 +47,7 @@ private:
return tmp; return tmp;
} }
static internal::types::PathData events_from_array(const PathEvent *firstEvent, static cbindgen_private::types::PathData events_from_array(const PathEvent *firstEvent,
size_t event_count, size_t event_count,
const Point *firstCoordinate, const Point *firstCoordinate,
size_t coordinate_count) size_t coordinate_count)
@ -59,7 +59,7 @@ private:
return Data::Events(events, coordinates); return Data::Events(events, coordinates);
} }
using Data = internal::types::PathData; using Data = cbindgen_private::types::PathData;
Data data; Data data;
}; };

View file

@ -12,7 +12,7 @@ LICENSE END */
#include <string_view> #include <string_view>
namespace sixtyfps { namespace sixtyfps {
namespace internal { namespace cbindgen_private {
struct PropertyAnimation; struct PropertyAnimation;
} }
} }
@ -24,13 +24,13 @@ namespace sixtyfps {
template<typename T> template<typename T>
struct Property struct Property
{ {
Property() { internal::sixtyfps_property_init(&inner); } Property() { cbindgen_private::sixtyfps_property_init(&inner); }
~Property() { internal::sixtyfps_property_drop(&inner); } ~Property() { cbindgen_private::sixtyfps_property_drop(&inner); }
Property(const Property &) = delete; Property(const Property &) = delete;
Property(Property &&) = delete; Property(Property &&) = delete;
Property &operator=(const Property &) = delete; Property &operator=(const Property &) = delete;
explicit Property(const T &value) : value(value) { explicit Property(const T &value) : value(value) {
internal::sixtyfps_property_init(&inner); cbindgen_private::sixtyfps_property_init(&inner);
} }
/* Should it be implicit? /* Should it be implicit?
@ -41,19 +41,19 @@ struct Property
void set(const T &value) const void set(const T &value) const
{ {
this->value = value; this->value = value;
internal::sixtyfps_property_set_changed(&inner); cbindgen_private::sixtyfps_property_set_changed(&inner);
} }
const T &get() const const T &get() const
{ {
internal::sixtyfps_property_update(&inner, &value); cbindgen_private::sixtyfps_property_update(&inner, &value);
return value; return value;
} }
template<typename F> template<typename F>
void set_binding(F binding) const void set_binding(F binding) const
{ {
internal::sixtyfps_property_set_binding( cbindgen_private::sixtyfps_property_set_binding(
&inner, &inner,
[](void *user_data, void *value) { [](void *user_data, void *value) {
*reinterpret_cast<T *>(value) = (*reinterpret_cast<F *>(user_data))(); *reinterpret_cast<T *>(value) = (*reinterpret_cast<F *>(user_data))();
@ -62,35 +62,35 @@ struct Property
} }
inline void set_animated_value(const T &value, inline void set_animated_value(const T &value,
const internal::PropertyAnimation &animation_data); const cbindgen_private::PropertyAnimation &animation_data);
template<typename F> template<typename F>
inline void set_animated_binding(F binding, const internal::PropertyAnimation &animation_data); inline void set_animated_binding(F binding, const cbindgen_private::PropertyAnimation &animation_data);
private: private:
internal::PropertyHandleOpaque inner; cbindgen_private::PropertyHandleOpaque inner;
mutable T value{}; mutable T value{};
}; };
template<> template<>
void Property<int32_t>::set_animated_value(const int32_t &new_value, void Property<int32_t>::set_animated_value(const int32_t &new_value,
const internal::PropertyAnimation &animation_data) const cbindgen_private::PropertyAnimation &animation_data)
{ {
internal::sixtyfps_property_set_animated_value_int(&inner, value, new_value, &animation_data); cbindgen_private::sixtyfps_property_set_animated_value_int(&inner, value, new_value, &animation_data);
} }
template<> template<>
void Property<float>::set_animated_value(const float &new_value, void Property<float>::set_animated_value(const float &new_value,
const internal::PropertyAnimation &animation_data) const cbindgen_private::PropertyAnimation &animation_data)
{ {
internal::sixtyfps_property_set_animated_value_float(&inner, value, new_value, &animation_data); cbindgen_private::sixtyfps_property_set_animated_value_float(&inner, value, new_value, &animation_data);
} }
template<> template<>
template<typename F> template<typename F>
void Property<int32_t>::set_animated_binding(F binding, void Property<int32_t>::set_animated_binding(F binding,
const internal::PropertyAnimation &animation_data) const cbindgen_private::PropertyAnimation &animation_data)
{ {
internal::sixtyfps_property_set_animated_binding_int( cbindgen_private::sixtyfps_property_set_animated_binding_int(
&inner, &inner,
[](void *user_data, int32_t *value) { [](void *user_data, int32_t *value) {
*reinterpret_cast<int32_t *>(value) = (*reinterpret_cast<F *>(user_data))(); *reinterpret_cast<int32_t *>(value) = (*reinterpret_cast<F *>(user_data))();
@ -102,9 +102,9 @@ void Property<int32_t>::set_animated_binding(F binding,
template<> template<>
template<typename F> template<typename F>
void Property<float>::set_animated_binding(F binding, void Property<float>::set_animated_binding(F binding,
const internal::PropertyAnimation &animation_data) const cbindgen_private::PropertyAnimation &animation_data)
{ {
internal::sixtyfps_property_set_animated_binding_float( cbindgen_private::sixtyfps_property_set_animated_binding_float(
&inner, &inner,
[](void *user_data, float *value) { [](void *user_data, float *value) {
*reinterpret_cast<float *>(value) = (*reinterpret_cast<F *>(user_data))(); *reinterpret_cast<float *>(value) = (*reinterpret_cast<F *>(user_data))();
@ -115,18 +115,18 @@ void Property<float>::set_animated_binding(F binding,
struct PropertyTracker struct PropertyTracker
{ {
PropertyTracker() { internal::sixtyfps_property_tracker_init(&inner); } PropertyTracker() { cbindgen_private::sixtyfps_property_tracker_init(&inner); }
~PropertyTracker() { internal::sixtyfps_property_tracker_drop(&inner); } ~PropertyTracker() { cbindgen_private::sixtyfps_property_tracker_drop(&inner); }
PropertyTracker(const PropertyTracker &) = delete; PropertyTracker(const PropertyTracker &) = delete;
PropertyTracker &operator=(const PropertyTracker &) = delete; PropertyTracker &operator=(const PropertyTracker &) = delete;
bool is_dirty() const { bool is_dirty() const {
return internal::sixtyfps_property_tracker_is_dirty(&inner); return cbindgen_private::sixtyfps_property_tracker_is_dirty(&inner);
} }
template<typename F> template<typename F>
void evaluate(const F &f) const { void evaluate(const F &f) const {
internal::sixtyfps_property_tracker_evaluate( cbindgen_private::sixtyfps_property_tracker_evaluate(
&inner, &inner,
[](void *f){ (*reinterpret_cast<const F*>(f))(); }, [](void *f){ (*reinterpret_cast<const F*>(f))(); },
const_cast<F*>(&f) const_cast<F*>(&f)
@ -134,7 +134,7 @@ struct PropertyTracker
} }
private: private:
internal::PropertyTrackerOpaque inner; cbindgen_private::PropertyTrackerOpaque inner;
}; };
} // namespace sixtyfps } // namespace sixtyfps

View file

@ -18,13 +18,13 @@ namespace sixtyfps {
struct Resource struct Resource
{ {
public: public:
using Tag = internal::types::Resource::Tag; using Tag = cbindgen_private::types::Resource::Tag;
Resource() : data(Data::None()) { } Resource() : data(Data::None()) { }
Resource(const SharedString &file_path) : data(Data::AbsoluteFilePath(file_path)) { } Resource(const SharedString &file_path) : data(Data::AbsoluteFilePath(file_path)) { }
private: private:
using Data = internal::types::Resource; using Data = cbindgen_private::types::Resource;
Data data; Data data;
}; };

View file

@ -18,23 +18,23 @@ struct SharedArray
{ {
SharedArray() SharedArray()
{ {
internal::sixtyfps_shared_array_new_null(reinterpret_cast<SharedArray<uint8_t> *>(this)); cbindgen_private::sixtyfps_shared_array_new_null(reinterpret_cast<SharedArray<uint8_t> *>(this));
} }
SharedArray(const SharedArray &other) SharedArray(const SharedArray &other)
{ {
internal::sixtyfps_shared_array_clone( cbindgen_private::sixtyfps_shared_array_clone(
reinterpret_cast<SharedArray<uint8_t> *>(this), reinterpret_cast<SharedArray<uint8_t> *>(this),
reinterpret_cast<const SharedArray<uint8_t> *>(&other)); reinterpret_cast<const SharedArray<uint8_t> *>(&other));
} }
~SharedArray() ~SharedArray()
{ {
internal::sixtyfps_shared_array_drop(reinterpret_cast<SharedArray<uint8_t> *>(this)); cbindgen_private::sixtyfps_shared_array_drop(reinterpret_cast<SharedArray<uint8_t> *>(this));
} }
SharedArray &operator=(const SharedArray &other) SharedArray &operator=(const SharedArray &other)
{ {
internal::sixtyfps_shared_array_drop(reinterpret_cast<SharedArray<uint8_t> *>(this)); cbindgen_private::sixtyfps_shared_array_drop(reinterpret_cast<SharedArray<uint8_t> *>(this));
internal::sixtyfps_shared_array_clone( cbindgen_private::sixtyfps_shared_array_clone(
reinterpret_cast<SharedArray<uint8_t> *>(this), reinterpret_cast<SharedArray<uint8_t> *>(this),
reinterpret_cast<const SharedArray<uint8_t> *>(&other)); reinterpret_cast<const SharedArray<uint8_t> *>(&other));
return *this; return *this;

View file

@ -17,8 +17,8 @@ namespace sixtyfps {
// template<typename... Args> // template<typename... Args>
struct Signal struct Signal
{ {
Signal() { internal::sixtyfps_signal_init(&inner); } Signal() { cbindgen_private::sixtyfps_signal_init(&inner); }
~Signal() { internal::sixtyfps_signal_drop(&inner); } ~Signal() { cbindgen_private::sixtyfps_signal_drop(&inner); }
Signal(const Signal &) = delete; Signal(const Signal &) = delete;
Signal(Signal &&) = delete; Signal(Signal &&) = delete;
Signal &operator=(const Signal &) = delete; Signal &operator=(const Signal &) = delete;
@ -26,7 +26,7 @@ struct Signal
template<typename F> template<typename F>
void set_handler(F binding) void set_handler(F binding)
{ {
internal::sixtyfps_signal_set_handler( cbindgen_private::sixtyfps_signal_set_handler(
&inner, &inner,
[](void *user_data) { [](void *user_data) {
(*reinterpret_cast<F *>(user_data))(); (*reinterpret_cast<F *>(user_data))();
@ -36,10 +36,10 @@ struct Signal
void emit() const void emit() const
{ {
internal::sixtyfps_signal_emit(&inner); cbindgen_private::sixtyfps_signal_emit(&inner);
} }
private: private:
internal::SignalOpaque inner; cbindgen_private::SignalOpaque inner;
}; };
} }

View file

@ -16,27 +16,27 @@ namespace sixtyfps {
struct SharedString struct SharedString
{ {
SharedString() { internal::sixtyfps_shared_string_from_bytes(this, "", 0); } SharedString() { cbindgen_private::sixtyfps_shared_string_from_bytes(this, "", 0); }
SharedString(std::string_view s) SharedString(std::string_view s)
{ {
internal::sixtyfps_shared_string_from_bytes(this, s.data(), s.size()); cbindgen_private::sixtyfps_shared_string_from_bytes(this, s.data(), s.size());
} }
SharedString(const char *s) : SharedString(std::string_view(s)) { } SharedString(const char *s) : SharedString(std::string_view(s)) { }
SharedString(const SharedString &other) SharedString(const SharedString &other)
{ {
internal::sixtyfps_shared_string_clone(this, &other); cbindgen_private::sixtyfps_shared_string_clone(this, &other);
} }
~SharedString() { internal::sixtyfps_shared_string_drop(this); } ~SharedString() { cbindgen_private::sixtyfps_shared_string_drop(this); }
SharedString &operator=(const SharedString &other) SharedString &operator=(const SharedString &other)
{ {
internal::sixtyfps_shared_string_drop(this); cbindgen_private::sixtyfps_shared_string_drop(this);
internal::sixtyfps_shared_string_clone(this, &other); cbindgen_private::sixtyfps_shared_string_clone(this, &other);
return *this; return *this;
} }
SharedString &operator=(std::string_view s) SharedString &operator=(std::string_view s)
{ {
internal::sixtyfps_shared_string_drop(this); cbindgen_private::sixtyfps_shared_string_drop(this);
internal::sixtyfps_shared_string_from_bytes(this, s.data(), s.size()); cbindgen_private::sixtyfps_shared_string_from_bytes(this, s.data(), s.size());
return *this; return *this;
} }
SharedString &operator=(SharedString &&other) SharedString &operator=(SharedString &&other)
@ -45,8 +45,8 @@ struct SharedString
return *this; return *this;
} }
operator std::string_view() const { return internal::sixtyfps_shared_string_bytes(this); } operator std::string_view() const { return cbindgen_private::sixtyfps_shared_string_bytes(this); }
auto data() const -> const char * { return internal::sixtyfps_shared_string_bytes(this); } auto data() const -> const char * { return cbindgen_private::sixtyfps_shared_string_bytes(this); }
static SharedString from_number(double n) { return SharedString(n); } static SharedString from_number(double n) { return SharedString(n); }
@ -61,7 +61,7 @@ struct SharedString
private: private:
/// Use SharedString::from_number /// Use SharedString::from_number
explicit SharedString(double n) { internal::sixtyfps_shared_string_from_number(this, n); } explicit SharedString(double n) { cbindgen_private::sixtyfps_shared_string_from_number(this, n); }
void *inner; // opaque void *inner; // opaque
}; };
} }

View file

@ -15,10 +15,10 @@ LICENSE END */
namespace sixtyfps::testing { namespace sixtyfps::testing {
inline void mock_elapsed_time(int64_t time_in_ms) inline void mock_elapsed_time(int64_t time_in_ms)
{ {
internal::sixtyfps_mock_elapsed_time(time_in_ms); cbindgen_private::sixtyfps_mock_elapsed_time(time_in_ms);
} }
template<typename Component> template<typename Component>
inline void send_mouse_click(Component &component, float x, float y) { inline void send_mouse_click(Component &component, float x, float y) {
internal::sixtyfps_send_mouse_click({&Component::component_type, &component}, x, y); cbindgen_private::sixtyfps_send_mouse_click({&Component::component_type, &component}, x, y);
} }
} // namespace sixtyfps } // namespace sixtyfps

View file

@ -251,7 +251,7 @@ fn property_animation_code(
) -> Option<String> { ) -> Option<String> {
if let Some(animation) = element.property_animations.get(property_name) { if let Some(animation) = element.property_animations.get(property_name) {
Some(new_struct_with_bindings( Some(new_struct_with_bindings(
"sixtyfps::internal::PropertyAnimation", "sixtyfps::cbindgen_private::PropertyAnimation",
&animation.borrow().bindings, &animation.borrow().bindings,
component, component,
)) ))
@ -658,7 +658,7 @@ fn generate_component(
Access::Public, Access::Public,
Declaration::Function(Function { Declaration::Function(Function {
name: "root_item".into(), name: "root_item".into(),
signature: "() -> VRef<sixtyfps::internal::ItemVTable>".into(), signature: "() -> VRef<sixtyfps::cbindgen_private::ItemVTable>".into(),
statements: Some(vec![format!( statements: Some(vec![format!(
"return {{ &sixtyfps::{vt}, &this->{id} }};", "return {{ &sixtyfps::{vt}, &this->{id} }};",
vt = root_elem.base_type.as_native().vtable_symbol, vt = root_elem.base_type.as_native().vtable_symbol,

View file

@ -60,7 +60,7 @@ fn main() {
let mut config = cbindgen::Config { let mut config = cbindgen::Config {
pragma_once: true, pragma_once: true,
include_version: true, include_version: true,
namespaces: Some(vec!["sixtyfps".into(), "internal".into()]), namespaces: Some(vec!["sixtyfps".into(), "cbindgen_private".into()]),
line_length: 100, line_length: 100,
tab_width: 4, tab_width: 4,
// Note: we might need to switch to C if we need to generate bindings for language that needs C headers // Note: we might need to switch to C if we need to generate bindings for language that needs C headers
@ -153,7 +153,7 @@ fn main() {
// Put the rust type in a deeper "types" namespace, so the use of same type in for example generated // Put the rust type in a deeper "types" namespace, so the use of same type in for example generated
// Property<> fields uses the public `sixtyfps::Blah` type // Property<> fields uses the public `sixtyfps::Blah` type
special_config.namespaces = special_config.namespaces =
Some(vec!["sixtyfps".into(), "internal".into(), "types".into()]); Some(vec!["sixtyfps".into(), "cbindgen_private".into(), "types".into()]);
cbindgen::Builder::new() cbindgen::Builder::new()
.with_config(special_config) .with_config(special_config)
.with_src(crate_dir.join("graphics.rs")) .with_src(crate_dir.join("graphics.rs"))

View file

@ -17,7 +17,7 @@ fn main() {
let config = cbindgen::Config { let config = cbindgen::Config {
pragma_once: true, pragma_once: true,
include_version: true, include_version: true,
namespaces: Some(vec!["sixtyfps".into(), "internal".into()]), namespaces: Some(vec!["sixtyfps".into(), "cbindgen_private".into()]),
line_length: 100, line_length: 100,
tab_width: 4, tab_width: 4,
// Note: we might need to switch to C if we need to generate bindings for language that needs C headers // Note: we might need to switch to C if we need to generate bindings for language that needs C headers