vyre-driver 0.4.1

Driver layer: registry, runtime, pipeline, routing, diagnostics. Substrate-agnostic backend machinery. Part of the vyre GPU compiler.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::borrow::Cow;

use serde::{Deserialize, Deserializer};

/// Deserialize helper that forces an owned `Cow<'static, str>`.
pub(crate) fn de_cow_static<'de, D: Deserializer<'de>>(
    d: D,
) -> Result<Cow<'static, str>, D::Error> {
    String::deserialize(d).map(Cow::Owned)
}

/// Deserialize helper for `Option<Cow<'static, str>>`.
pub(crate) fn de_opt_cow_static<'de, D: Deserializer<'de>>(
    d: D,
) -> Result<Option<Cow<'static, str>>, D::Error> {
    Option::<String>::deserialize(d).map(|opt| opt.map(Cow::Owned))
}