补全边角
This commit is contained in:
+3
-1
@@ -97,6 +97,7 @@ A property descriptor exposes compile-time structural facts:
|
||||
using Property = std::remove_cvref_t<decltype(schema.property<&Device::temperature>())>;
|
||||
static_assert(Property::readable);
|
||||
static_assert(Property::writable);
|
||||
static_assert(Property::runtime_copy_writable);
|
||||
using Value = Property::value_type;
|
||||
using Accessor = Property::accessor_type;
|
||||
```
|
||||
@@ -570,7 +571,7 @@ For a synchronized writable property, Structive keeps the corresponding managed
|
||||
auto result = erased.runtime_write("temperature", typeid(double), &value);
|
||||
```
|
||||
|
||||
Runtime write intentionally performs no implicit conversion. `typeid(double)` must exactly match the property's declared value type, and the pointer must address a live value of that exact type for the duration of the call. A successful runtime write uses the same managed write path and synchronization semantics as typed `write`.
|
||||
Runtime write intentionally performs no implicit conversion. `typeid(double)` must exactly match the property's declared value type, and the pointer must address a live value of that exact type for the duration of the call. The boundary copies from a `const` input. If a writable accessor cannot accept that copy input, its descriptor exposes `runtime_copy_writable == false` and runtime access returns `unsupported_runtime_write`; typed `write` still accepts move-only values when the accessor supports them. A successful runtime write uses the same managed synchronization path as typed `write`.
|
||||
|
||||
### 22.3 Result contract
|
||||
|
||||
@@ -580,6 +581,7 @@ Runtime write intentionally performs no implicit conversion. `typeid(double)` mu
|
||||
| `unknown_property` | no schema property has that runtime key |
|
||||
| `not_readable` | the property exists but its intrinsic capability is not readable |
|
||||
| `not_writable` | the property exists but its intrinsic capability is not writable |
|
||||
| `unsupported_runtime_write` | the property is intrinsically writable but its accessor cannot accept the runtime copy-input boundary |
|
||||
| `type_mismatch` | runtime write supplied a type different from the declared property value type |
|
||||
|
||||
There is no external/persistence access mode and no access-control policy in this API. An adapter decides whether it wants to expose or call runtime read/write; Structive reports only the property's intrinsic capability.
|
||||
|
||||
@@ -95,6 +95,7 @@ Descriptor 暴露编译期结构事实:
|
||||
using Property = std::remove_cvref_t<decltype(schema.property<&Device::temperature>())>;
|
||||
static_assert(Property::readable);
|
||||
static_assert(Property::writable);
|
||||
static_assert(Property::runtime_copy_writable);
|
||||
using Value = Property::value_type;
|
||||
using Accessor = Property::accessor_type;
|
||||
```
|
||||
@@ -562,7 +563,7 @@ auto result = erased.runtime_read("temperature", context, callback);
|
||||
auto result = erased.runtime_write("temperature", typeid(double), &value);
|
||||
```
|
||||
|
||||
Runtime write 明确不做隐式转换。`typeid(double)` 必须与 Property 声明的 value type 完全一致,`value` 指针在调用期间必须指向这个精确类型的有效对象。成功写入复用 typed `write` 的同一 managed write 和 synchronization 语义。
|
||||
Runtime write 明确不做隐式转换。`typeid(double)` 必须与 Property 声明的 value type 完全一致,`value` 指针在调用期间必须指向这个精确类型的有效对象。这个边界从 `const` 输入复制;如果一个 intrinsically writable Accessor 无法接受 copy-input,它会暴露 `runtime_copy_writable == false`,runtime access 返回 `unsupported_runtime_write`,而 typed `write` 在 Accessor 支持时仍可正常接收 move-only 值。成功写入继续复用 typed `write` 的 managed synchronization 路径。
|
||||
|
||||
### 22.3 Result Contract
|
||||
|
||||
@@ -572,6 +573,7 @@ Runtime write 明确不做隐式转换。`typeid(double)` 必须与 Property 声
|
||||
| `unknown_property` | Schema 中不存在该 runtime key |
|
||||
| `not_readable` | Property 存在,但 intrinsic capability 不可读 |
|
||||
| `not_writable` | Property 存在,但 intrinsic capability 不可写 |
|
||||
| `unsupported_runtime_write` | Property intrinsically writable,但 Accessor 无法接收 runtime copy-input 边界 |
|
||||
| `type_mismatch` | runtime write 提供的类型和 Property value type 不一致 |
|
||||
|
||||
这里没有 external/persistence mode,也没有访问控制 policy。Adapter 自己决定是否对外暴露、是否调用 runtime read/write;Structive 只报告 Property 自身的 intrinsic capability。
|
||||
|
||||
+1
-1
@@ -298,7 +298,7 @@ Examples:
|
||||
- requesting a typed unique guard for a read-only property;
|
||||
- reading a write-only property.
|
||||
|
||||
Runtime key APIs report dynamic failures through `Runtime_Access_Result`.
|
||||
Runtime key APIs report dynamic failures through `Runtime_Access_Result`. The runtime write boundary is copy-input by design: intrinsic `writable` remains a structural fact, while `runtime_copy_writable` states whether the accessor can participate in that type-erased copy boundary. Move-only typed writes therefore do not get mislabeled as structurally non-writable.
|
||||
|
||||
### Rule
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ Adapter 自己决定是否暴露某个 Property、是否调用 runtime read/writ
|
||||
- 对 read-only property 请求 typed unique guard;
|
||||
- 读取 write-only property。
|
||||
|
||||
Runtime key API 才使用 `Runtime_Access_Result` 返回动态错误。
|
||||
Runtime key API 才使用 `Runtime_Access_Result` 返回动态错误。Runtime write 明确是 copy-input 边界:intrinsic `writable` 继续表示结构事实,`runtime_copy_writable` 单独表示 Accessor 是否能参与 type-erased copy write。这样 move-only typed write 不会被错误描述成结构上不可写。
|
||||
|
||||
### 原则
|
||||
|
||||
|
||||
Reference in New Issue
Block a user