Shared crates

vld-integration-common

Internal building blocks shared by the database, UI and CLI integration crates.

vld-integration-common holds the code that several integration crates share. It is an internal crate with no stable API of its own: depend on the integration crate you need, which re-exports what it uses from here.

CrateUses
vld-dioxus, vld-leptosform module and validate_args!, re-exported as-is
vld-tauri, vld-clapformat_path / flatten_issues for issue paths
vld-sqlx, vld-diesel, vld-sea, vld-surrealdbmacros generating each crate's error type, Validated<S, T> and the VldText / VldInt / VldFloat / VldBool column wrappers

No features. MSRV: 1.85 (see MSRV).

Contents

  • format_path(&[PathSegment]) — a clean dotted path: user.email, items[0].name, no leading dot; an empty path gives "".
  • flatten_issues(&VldError) — (path, message) pairs built with format_path.
  • form — FieldError, VldServerError, validate, validate_value, check_field, check_field_all, check_all_fields and the validate_args! macro (documented on the vld-dioxus page).
  • db — hidden macros (__vld_db_error!, __vld_db_validated!, __vld_db_wrappers!). The wrapper types are generated inside each database crate so that it can implement its own database traits (sqlx::Type, diesel::ToSql, …) without orphan-rule conflicts.

Example

use vld::error::PathSegment;

let path = [
    PathSegment::Field("items".into()),
    PathSegment::Index(0),
    PathSegment::Field("name".into()),
];
assert_eq!(vld_integration_common::format_path(&path), "items[0].name");

Gotchas

  • Since 0.5 every integration crate built on this one reports paths without a leading dot (user.email, not .user.email). The HTTP adapters use vld-http-common instead.