Skip to main content

CustomValue

Trait CustomValue 

Source
pub trait CustomValue:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn type_name(&self) -> &'static str;
    fn as_any(&self) -> &dyn Any;

    // Provided method
    fn to_plain(&self) -> Value { ... }
}
Expand description

A dialect-specific value that keelson itself never interprets.

Implementors are carried through the builder untouched and handed to the backend, which recovers the concrete type with Self::as_any. This is where genuinely dialect-specific types live — PostgreSQL ranges, geometric types and the like. The types nearly every application binds (chrono, uuid, rust_decimal, serde_json) have first-class feature-gated variants instead, with their mappings recorded in docs/type-mappings.md.

Required Methods§

Source

fn type_name(&self) -> &'static str

The name used in error messages and Debug output.

Source

fn as_any(&self) -> &dyn Any

For downcasting in a backend adapter.

Provided Methods§

Source

fn to_plain(&self) -> Value

A plain stand-in used when the argument list is serialised, e.g. by a logger or a golden test. Returning another Value::Custom serialises as null; there is no recursion.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§