Some checks failed
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 2m13s
standards workspaces build + test / aac-rs (pull_request) Successful in 1m58s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 50s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 34s
standards workspaces build + test / map-rs (pull_request) Successful in 31s
standards workspaces build + test / mesh-rs (pull_request) Successful in 31s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Has been cancelled
no-vanity-metrics / WAI public text names no comparison (pull_request) Has been cancelled
no-vanity-metrics / WAI public text names no company or product (pull_request) Has been cancelled
standards workspaces build + test / arl-rs (pull_request) Has been cancelled
standards workspaces build + test / eoc-rs (pull_request) Has been cancelled
standards workspaces build + test / jcp-rs (pull_request) Has been cancelled
standards workspaces build + test / joule-ui-rs (pull_request) Has been cancelled
standards workspaces build + test / jouledesk-rs (pull_request) Has been cancelled
standards workspaces build + test / joulehook-rs (pull_request) Has been cancelled
standards workspaces build + test / proof-rs (pull_request) Has been cancelled
standards workspaces build + test / sandbox-rs (pull_request) Has been cancelled
standards workspaces build + test / sense-rs (pull_request) Has been cancelled
standards workspaces build + test / smart-byte-rs (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backends (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Has been cancelled
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · linux (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · macos (pull_request) Has been cancelled
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
WAI section references / cited sections exist (pull_request) Has been cancelled
wai-vector vector graphics / linux-aarch64 (pull_request) Has been cancelled
wai-vector vector graphics / linux-x86_64 (pull_request) Has been cancelled
wai-vector vector graphics / macos-arm64 (pull_request) Has been cancelled
wai-vector vector graphics / wasm32-wasip2 (wasmtime) (pull_request) Has been cancelled
wai-vector vector graphics / wasm32 under Node (pull_request) Has been cancelled
wai-vector vector graphics / fuzz, peak allocation, comparison count (pull_request) Has been cancelled
workflow hygiene / every workflow supersedes its own queue (pull_request) Has been cancelled
standards workspaces build + test / openpay (pull_request) Has been cancelled
The reference crate of wai.graphics.vector (no_std + alloc, no dependencies; SHA-256 is wai-ops's, by #[path]): - WOS1 parsed with §2.1's load checks in order, and written; - WVG1 split (steps 1-3, nothing allocated before the exact length), the record pass (step 4), the cross-record checks (step 5(a)-(h)), the sets by digest with at most length + 1 bytes read (step 6), the glyphs (7), the interval check (8) and the per-frame cost (9); - the clock with the frame range by division, track evaluation, and placement; - the JSON authoring form, one member per field, packing back to the same bytes; - the CLI: check, cost, pack, unpack, vectors gen and verify; - a wasm32 module and verify.mjs for Node. The corpus wai/vector-conformance/ (arith, canonical, refusals, geometry, cost) with its README's provenance line and a sha256.json sidecar naming the div255 table; wai-vector.yml with native, wasip2, node and fuzz jobs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
79 lines
2.4 KiB
Rust
79 lines
2.4 KiB
Rust
//! The refusal codes of §2.1 and §2.7, the render request errors of §2.7, and where a
|
|
//! refusal was found.
|
|
//!
|
|
//! The code is normative: two conforming sinks that hold the same bytes report the same
|
|
//! one. The step and the rule are this implementation's diagnostics.
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
pub enum Code {
|
|
PayloadMalformed,
|
|
TooLarge,
|
|
FieldRange,
|
|
PointsLimit,
|
|
OutlineNotHeld,
|
|
OutlineMismatch,
|
|
OutlineMalformed,
|
|
GlyphMissing,
|
|
GeometryRange,
|
|
/// Render request errors (§2.7, *Render*): not refusals of the payload.
|
|
SizeUnlisted,
|
|
RateUnlisted,
|
|
FrameRange,
|
|
}
|
|
|
|
pub const CODES: [Code; 12] = [
|
|
Code::PayloadMalformed,
|
|
Code::TooLarge,
|
|
Code::FieldRange,
|
|
Code::PointsLimit,
|
|
Code::OutlineNotHeld,
|
|
Code::OutlineMismatch,
|
|
Code::OutlineMalformed,
|
|
Code::GlyphMissing,
|
|
Code::GeometryRange,
|
|
Code::SizeUnlisted,
|
|
Code::RateUnlisted,
|
|
Code::FrameRange,
|
|
];
|
|
|
|
impl Code {
|
|
pub const fn name(self) -> &'static str {
|
|
match self {
|
|
Code::PayloadMalformed => "payload_malformed",
|
|
Code::TooLarge => "too_large",
|
|
Code::FieldRange => "field_range",
|
|
Code::PointsLimit => "points_limit",
|
|
Code::OutlineNotHeld => "outline_not_held",
|
|
Code::OutlineMismatch => "outline_mismatch",
|
|
Code::OutlineMalformed => "outline_malformed",
|
|
Code::GlyphMissing => "glyph_missing",
|
|
Code::GeometryRange => "geometry_range",
|
|
Code::SizeUnlisted => "size_unlisted",
|
|
Code::RateUnlisted => "rate_unlisted",
|
|
Code::FrameRange => "frame_range",
|
|
}
|
|
}
|
|
pub fn from_name(s: &str) -> Option<Code> {
|
|
CODES.iter().copied().find(|c| c.name() == s)
|
|
}
|
|
}
|
|
|
|
/// A refusal: its code, the §2.7 (or §2.1) step that found it, the rule, and the
|
|
/// record index the rule failed at (0 where none applies).
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub struct Refusal {
|
|
pub code: Code,
|
|
pub step: &'static str,
|
|
pub rule: &'static str,
|
|
pub index: u64,
|
|
}
|
|
|
|
impl Refusal {
|
|
pub const fn new(code: Code, step: &'static str, rule: &'static str, index: u64) -> Refusal {
|
|
Refusal { code, step, rule, index }
|
|
}
|
|
}
|
|
|
|
pub(crate) const fn refuse<T>(code: Code, step: &'static str, rule: &'static str, index: u64) -> Result<T, Refusal> {
|
|
Err(Refusal::new(code, step, rule, index))
|
|
}
|