From bd9c7a8939b7184139700ecc4a8b67fae5bd6471 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 30 Nov 2023 13:24:27 +0900 Subject: [PATCH 1/3] wit: remove exposure it was a hack to maintain the rust api. i'm going to update our rust code. --- wit/property.wit | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/wit/property.wit b/wit/property.wit index 39bec04..15d30f7 100644 --- a/wit/property.wit +++ b/wit/property.wit @@ -7,29 +7,16 @@ interface property { denominator: u32 } - - - record exposure { - /// Mode of exposure. - mode: string, - /// More parameters for exposure. - } - - enum property-key { /// The number of samples in a second. (fraction) /// Eg. frame rate for image sensors. sampling-rate, - dimension, - exposure, } variant property-value { fraction(fraction), - dimension(dimension), - exposure(exposure), } } From 28935f55f9c2f38d86e835a38d9fa5e21e66536c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 30 Nov 2023 13:25:51 +0900 Subject: [PATCH 2/3] guest: remove exposure i hoped this kind of wit changes didn't affect the API. however, wit-bindgen rust has a bit complex rules (too complex in my taste) to decide types, which alters the API like this. cf. https://github.com/bytecodealliance/wit-bindgen/pull/676 --- guest_rust/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guest_rust/src/lib.rs b/guest_rust/src/lib.rs index 0ad481c..8830848 100644 --- a/guest_rust/src/lib.rs +++ b/guest_rust/src/lib.rs @@ -186,7 +186,7 @@ fn main2() -> Result<()> { denominator: *ratio.denom() as u32, }); println!("setting sampling rate to {:?}", value); - sensor.set_property(wasi::sensor::property::PropertyKey::SamplingRate, &value)?; + sensor.set_property(wasi::sensor::property::PropertyKey::SamplingRate, value)?; // confirm the result let value = sensor.get_property(wasi::sensor::property::PropertyKey::SamplingRate)?; println!("sensor sampling rate {:?}", value); From f6c3ac20fdc8e306fdb5ab096175604b3e1fdbe1 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 30 Nov 2023 13:30:05 +0900 Subject: [PATCH 3/3] regen md --- sensing.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/sensing.md b/sensing.md index a27be68..7bb987f 100644 --- a/sensing.md +++ b/sensing.md @@ -112,12 +112,6 @@
  • numerator: u32
  • denominator: u32
  • -

    record exposure

    -
    Record Fields
    -
      -
    • mode: string

      Mode of exposure. -

    • -

    enum property-key

    Enum Cases

    variant property-value

    Variant Cases

    Import interface wasi:sensor/sensor