mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-04-19 20:19:50 +02:00
This will make the api much easier to use, as we can now rely on "" instead of "".into() for normal string values. Introduced builder as well, which makes it much easier to use *Opts, as it can handle the building of that, and get the benefits from String -> &str, as that is currently not allowed for optional values
17 lines
500 B
Rust
17 lines
500 B
Rust
use dagger_core::introspection::FullType;
|
|
use genco::prelude::rust;
|
|
use genco::quote;
|
|
|
|
use crate::rust::functions::format_name;
|
|
use crate::utility::OptionExt;
|
|
|
|
pub fn render_scalar(t: &FullType) -> eyre::Result<rust::Tokens> {
|
|
let deserialize = rust::import("serde", "Deserialize");
|
|
let serialize = rust::import("serde", "Serialize");
|
|
|
|
Ok(quote! {
|
|
#[derive($serialize, $deserialize, PartialEq, Debug, Clone)]
|
|
pub struct $(t.name.pipe(|n|format_name(n)))(String);
|
|
})
|
|
}
|