Commit graph

19 commits

Author SHA1 Message Date
Simon Hausmann
e8302452b5 Make it possible to compile sharedvector and sharedstring with atomic-polyfill 2021-11-30 15:32:47 +01:00
Olivier Goffart
80c0602277 WIP: start making the corelib crate a no_std crate
Does not compile yet with no_std because of the lack of
alternative for thread_local
2021-11-25 12:02:16 +01:00
Simon Hausmann
386d61d648 Simplify Rust’s SharedVector::clear() when the vector is shared
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-08-12 13:41:08 +02:00
Simon Hausmann
d65af654d7 Changed Rust's SharedVector::clear() to not preserve capacity when shared 2021-08-12 13:41:08 +02:00
Simon Hausmann
856a049627 Implement SharedVector::clear() for Rust 2021-08-12 13:41:08 +02:00
Simon Hausmann
0852a7661b Fix mutable slice API
* Change SharedVector::as_mut_slice() to SharedVector::make_mut_slice()
* SharedPixelBuffer::as_mut_slice and SharedPixelBuffer::make_mut_slice()
* SharedPixelBuffer::as_bytes_mut() to SharedPixelBuffer::make_mut_bytes()

This is consistent with Rc::make_mut() and is supposed to emphasize
that, unlike the usual as_* operations, it is not a free operation but
may involve work (detaching the data by cloning it).

Amends commit 7384ebdc32
2021-08-10 16:37:34 +02:00
Simon Hausmann
7384ebdc32 Deprecated SharedVector::as_slice_mut() in favor of SharedVector::as_mut_slice()
The standard library uses the latter name.
2021-08-09 14:51:09 +02:00
Tobias Hunger
bac4d895ce Janitor: Fix clippy::while_let_on_iterator 2021-08-09 13:19:34 +02:00
Simon Hausmann
b4ba77dba7 Fix SharedVector creation from iterators with default size hints
* In capacity_for_grow, don't compare the number of elements
  (current_cap) with the size of an element in bytes, but
  with the required capacity instead (to detect that we don't need
  to grow). Not all call sites check for that (i.e. push), so there's
  a new test for that.

* When re-allocating due to growth and copying elements from the old
  inner to the new inner, make sure to copy all old elements from the beginning,
  not only the last element repeatedly.
2021-08-06 16:18:33 +02:00
Tobias Hunger
22c65707b2 Janitor: Fix clippy::len_zero 2021-08-04 22:50:35 +02:00
Tobias Hunger
60ef093aaa Janitor: Fix clippy::len_without_is_empty 2021-08-04 22:50:35 +02:00
Tobias Hunger
f1f0182826 Janitor: Fix clippy::needless_return 2021-07-30 09:27:48 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Olivier Goffart
ea0abe3031 Fix a few UB found by miri
An empty vector is not a `SharedVectorInner<T>`, it is a `SharedVectorInner<()>`
And so it is UB to take a reference of a `SharedVectorInner<T>` for the empty vector
2021-06-01 11:52:43 +02:00
Olivier Goffart
35cce45cbc Add a fii feature so that we don't compile in the ffi code if not required 2021-03-16 18:09:57 +01:00
Simon Hausmann
f087cc18bc Remove extern "C" functions from wasm module
We don't need these functions and their export. They account for ~20kb in
the optimized .wasm - plus JS glue code.
2021-02-26 17:04:49 +01:00
Simon Hausmann
b90eb04088 Begin with the brush data structure
This patch also adds `extend` to `SharedVector`, for convenience.
2021-02-01 14:45:49 +01:00
Olivier Goffart
dfa25b96f7 Rename SharedArray to SharedVector 2020-12-18 10:26:07 +01:00
Renamed from sixtyfps_runtime/corelib/sharedarray.rs (Browse further)