Closed Bug 1302213 Opened 8 years ago Closed 4 years ago

Implement rust bindings for interacting with nsTArray

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: nika, Unassigned)

References

(Blocks 1 open bug)

Details

nsTArray is used a lot, It would be nice to have a way to share the type to rust easily.
Priority: -- → P3
Transcript from talk about this bug with :manishearth on IRC (#content):

<qDot> Manishearth: How easy would it be to abstract the nsTArray bindings in stylo a bit to make a starter patch for bug 1302213?
<Manishearth> qDot: it's straightforward
<Manishearth> qDot: https://github.com/servo/servo/blob/master/components/style/gecko_bindings/sugar/ns_t_array.rs
<Manishearth> qDot: ah, one complication is that you don't have bindgen to get you the generated nsTArray struct
<Manishearth> you have to check it in manually
<Manishearth> you also need to move these two functions to somewhere else
<Manishearth> https://dxr.mozilla.org/mozilla-central/source/layout/style/ServoBindings.cpp#825
<Manishearth> ensuretarraycapacity and clearpodarray
<Manishearth> check out how the nsstring crate works
<Manishearth> fwiw mystor is aware of servo's nstarray bindings
<Manishearth> (they just didn't exist when that bug was filed)
This exists now in the form of https://crates.io/crates/thin-vec .

[dependencies.thin-vec]
version = "0.1.0"
features = ["gecko-ffi"]

It's not being used in mozilla-central yet.

Nika added support for reflecting XPIDL Array<T>s into Rust ThinVecs over in bug 1530467, and we have several crates using thin_vec now—this can probably be closed.

Status: NEW → RESOLVED
Closed: 4 years ago
Depends on: 1530467
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.