ohos-sys 0.9.0

Bindings to the native API of OpenHarmony OS
Documentation
# Local TODOs

Local scratchpad — gitignored. Not shipped with releases.

- Duplicate gates in `ui_input_event_anon_enums_ffi.rs`: semantically correct (`api-22` implies `api-12`), just redundant. Bindgen emits attributes for both the parent enum's `@since 12` and the variant's `@since 22`. Generator-level fix needed in `DoxygenCommentCb::parse_comments_for_attributes` to dedupe;

## API-22/23: non-opaque cross-crate types

API-22/23 added new functions whose signatures reference *non-opaque* concrete
value types from a different crate. They can't go through `ohos-sys-opaque-types`
(it only holds forward-declared / handle types — anything where the layout or
enum variants matter has to come from its home crate). Currently blocklisted
in `scripts/generator/src/{dir_conf,header_conf}.rs`; see comments next to
each `.blocklist_function(...)`.

| Type | Home crate | Used by (blocklisted function) |
|---|---|---|
| `OH_NativeBuffer_Format` (enum) | `ohos-window-sys::native_buffer::buffer_common` | `ohos-image-kit-sys`: `OH_ImageNative_GetFormat` (api-23) |
| `OH_NativeBuffer_Format` | same | `ohos-media-sys`: `OH_AVCapability_GetVideoSupportedNativeBufferFormats` (api-22) |
| `OH_Drawing_LineMetrics` (struct, public fields) | `ohos-drawing-sys::text_typography` | `arkui-sys::styled_string`: `OH_ArkUI_TextLayoutManager_GetLineMetrics` (api-22) |
| `OH_Drawing_RectHeightStyle` (enum) | `ohos-drawing-sys::text_typography` | `arkui-sys::styled_string`: `OH_ArkUI_TextLayoutManager_GetRectsForRange` (api-22) |
| `OH_Drawing_RectWidthStyle` (enum) | `ohos-drawing-sys::text_typography` | same as above |

Options:
1. Add optional cross-crate dependencies — e.g. `arkui-sys` gets an optional
   `ohos-drawing-sys` dep (likely behind an existing `drawing` feature), gate
   the dependent functions with `#[cfg(feature = "drawing")]`. Same for
   `ohos-image-kit-sys` / `ohos-media-sys``ohos-window-sys` (probably
   behind a new `native_buffer` feature on each).
2. Introduce a dedicated `ohos-shared-types-sys` crate that holds the
   non-opaque types that need to be referenced across multiple `-sys` crates
   (`OH_NativeBuffer_Format`, drawing line-metrics / rect-style types,
   future similar cases). Pros: avoids feature-gated cross-crate webs; cons:
   another crate to publish & version.

Decision pending — keep blocklisting until we pick one.

## bindgen

- [ ] **`comment::preprocess_multi_line` doesn't strip inner block-comment
      delimiters when clang concatenates two adjacent `/** */` blocks.**
  When a C header places a "section header" comment immediately before a
  per-item comment, libclang hands bindgen a single string of the form
  `/** A */\n/** B */`. `preprocess_multi_line` only strips the *outer* `/*`
  and `*/` from the whole text, so the inner delimiters survive into the
  doc attribute:
  ```c
  /** Tags for key parameters. The value range is 1 to 200. */
  /** Algorithm. */
  OH_HUKS_TAG_ALGORITHM = OH_HUKS_TAG_TYPE_UINT | 1,
  ```
  After preprocess: ` Tags for key parameters. The value range is 1 to 200. */\n/** Algorithm.`
  → doxygen-rs passes that through as literal text (the delimiters aren't
  doxygen syntax) → bindgen prefixes each line with `///`, producing:
  ```rust
  /// Tags for key parameters. The value range is 1 to 200. */
  ////** Algorithm.
  pub const OH_HUKS_TAG_ALGORITHM: OH_Huks_Tag = OH_Huks_Tag(536870913);
  ```
  Currently visible on at least 5 items in
  `components/huks/src/native_huks_type/native_huks_type_ffi.rs`
  (`OH_HUKS_TAG_ALGORITHM`, `OH_HUKS_TAG_ALL_USERS`,
  `OH_HUKS_TAG_ATTESTATION_CHALLENGE`, `OH_HUKS_TAG_IS_KEY_ALIAS`,
  `OH_HUKS_TAG_SYMMETRIC_KEY_DATA`). Fix in `bindgen/ir/comment.rs` by either
  (a) splitting the input on `*/\s*/\*\*?` and recursing on each block
  separately, or (b) stripping inner `/**` / `*/` delimiters after the
  per-line `*` strip.

## doxygen-rs

- [ ] **Doxygen `#`-anchor references don't transform into rustdoc intra-doc
      links.**
  Doxygen lets you reference an enum variant as `EnumName#VARIANT_NAME`, but
  rustdoc treats `#` as an HTML fragment, not a path separator. doxygen-rs
  currently emits these as ``[`OH_Huks_ErrCode#OH_HUKS_SUCCESS`]`` — rustdoc
  renders the literal text and emits broken-intra-doc-link warnings.
  Hundreds of occurrences in `components/huks/src/native_huks_api/`. Fix by
  rewriting `Foo#BAR` to `Foo::BAR` (or just `BAR`, if `Foo` is already in
  scope) when emitting markdown links.