Commit graph

45 commits

Author SHA1 Message Date
Olivier Goffart
f39b3ab888 Use "C-unwind" API in our vtable
When using rust, allow panics to cross the boundaries of our vtable traits.
This avoids panic producing two backtrace with panic=unwind

This patch doesn't touch the ABI of out FFI interface, they stay extern "C", because
if a panic or exception crosses these boundaries, we are in trouble.
(Also, we have a panic=abort in our Cargo.toml anyway)
2025-06-06 14:47:46 +02:00
Tobias Hunger
0139eea4f9 xtask: Fix up license headers
* Keep project related .md files triple licensed as the rest of the
  crate
* Make vtable MIT OR Apache 2.0 (as suggested by @ogoffart)
2023-08-17 08:55:28 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Simon Hausmann
2bf3f8389e Add test and ChangeLog entry for VRc::map_dyn 2022-07-22 23:09:08 +02:00
Tobias Hunger
f3feab1267
Implement ptr_eq for VWeak and PartialEq for Items (#976)
* Implement ptr_eq for VWeaks

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-21 17:45:18 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Olivier Goffart
81602353e2 Implement Default for VWeakMapped 2022-01-05 15:57:16 +01:00
Tobias Hunger
bfca0e3573 Mass update copyright messages to be more REUSE compliant 2021-12-22 10:06:12 +01:00
Olivier Goffart
41e180f184 Make vtable no_std 2021-11-25 12:02:16 +01:00
Simon Hausmann
94b19d3df9 Add VRcMapped::origin() 2021-11-08 13:41:52 +01:00
Simon Hausmann
5af91a133e Fix compilation when trying to clone VRcMappend and VWeakMapped
A #[derive(Clone)] imposes Clone on the VTable type, which
doesn't make sense here.
2021-11-05 11:17:55 +01:00
Olivier Goffart
c506e87484 Add VRcMapped::map 2021-11-05 09:50:58 +01:00
Simon Hausmann
2b70e28d54 Move VRcMapped::map to VRc::map
This makes the functionality easier to discover and seems more consistent.
2021-11-04 19:59:04 +01:00
Simon Hausmann
183ff6586b Add VrcMapped and VWeakMapped to allow for references to objects that are reachable via VRc
For now this requires pinning on the type contained in VRc as well as
the fields mapped to. This could be lifted using additional flags, but
for now this is what we need anyway.
2021-11-04 19:57:36 +01:00
Olivier Goffart
73ec3e6701 vtable: fix clippy warnings in tests
(ran with cargo clippy --tests)
2021-08-16 11:04:33 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Olivier Goffart
f7c8f40dec VRc: use atomic for the strong and weak count 2021-05-25 15:53:49 +02:00
Olivier Goffart
7f66ca9584 Add a function in the ComponentVTable to get an ItemRef from an index
Needed to adjust vtable so it can work if the return type has a reference
2020-11-11 14:29:44 +01:00
Olivier Goffart
a1f1fcb3a6 Use VRc<ComponentVTable> in the rust generated code 2020-11-09 14:58:37 +01:00
Olivier Goffart
7fbcb78606 vtable: change VRc and VWeak to add the concrete type as a parameter
... or `Dyn` if unkown.

So we can implement Deref for the concreate type.

Sicne Deref is implemented for VRc, all the method of VRc are now
associated function.
2020-11-06 11:50:31 +01:00
Olivier Goffart
270408d485 vtable::VRc: Add few comments and missing function found in review 2020-11-06 10:11:44 +01:00
Olivier Goffart
f852b0bb6a vtable: new VRc and VWeak pointer 2020-11-06 10:11:44 +01:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Olivier Goffart
0b1648d891 Fix formating 2020-08-04 11:52:47 +02:00
Olivier Goffart
1bfd708784 Change the field_offsets() function to a FIELD_OFFSETS associated const 2020-08-03 16:04:55 +02:00
Olivier Goffart
86a85cf838 vtable: change #[offset] to #[field_offset]
And add a documentation for it
2020-08-03 11:26:48 +02:00
Olivier Goffart
caca0d0ba4 Put the component in a Pin<>
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.

But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections
2020-06-24 14:13:27 +02:00
Olivier Goffart
bbb2b487b9 Implement a way to create a VRef for non static vtable 2020-06-12 17:09:51 +02:00
Olivier Goffart
5f01ec30ee Fix the viewer using generated rtti from a macro
One thing that needed to change is that we needed the vtable to be unique
2020-05-30 15:08:51 +02:00
Olivier Goffart
8c39ada671 Add downcast method to VRef and VRefMut 2020-05-28 09:18:28 +02:00
Olivier Goffart
07942da4bb vtable: introduce VOffset 2020-05-18 11:06:44 +02:00
Olivier Goffart
5a9cbaae66 vtable add support for field offset in the vtable 2020-05-18 11:06:44 +02:00
Olivier Goffart
aff3d7e14b vtable: add safe way to construct references 2020-05-18 11:06:44 +02:00
Olivier Goffart
810a3905a7 Add VBox::new 2020-05-18 11:06:44 +02:00
Olivier Goffart
b745c616f7 Add a trait to get the vtable for a type 2020-05-18 11:06:44 +02:00
Olivier Goffart
4ca45ca4da vtable crate: Some refactoring and simplifications 2020-05-18 11:06:44 +02:00
Olivier Goffart
49fc23224e vtable: Remove the TraitType wrapper, and allow Option<fn> 2020-05-18 11:06:44 +02:00
Olivier Goffart
8d9a64d249 vtable: add a macro to create a static vtable 2020-05-18 11:06:44 +02:00
Olivier Goffart
62010be72e vtable: support associated consts 2020-05-18 11:06:44 +02:00
Olivier Goffart
686f4c9591 More work on the vtable macro to adapt the Component
This does not work yet
2020-05-18 11:04:54 +02:00
Olivier Goffart
1ced4224b5 More work on the vtable crate 2020-05-18 11:04:54 +02:00
Olivier Goffart
5c5df6b8e3 Macro to generate trait and safe abstraction for a vtable 2020-05-13 23:07:59 +02:00