ryzz icon indicating copy to clipboard operation
ryzz copied to clipboard

Add default values

Open JosiahParry opened this issue 1 year ago • 0 comments

Implementing the default trait for a struct with the ryzz attribute macro results in a conflicting trait implementation.


#[table("shiny_apps")]
struct ShinyAppRow {
    #[ryzz(pk)]
    id: String,
    name: String,
    slug: Option<String>,
    min_instances: i64,
    max_instances: i64,
    spawn_threshold: i64,
    inactive_timeout: i64,
    connection_timeout: i64,
}

impl Default for ShinyAppRow {
    fn default() -> Self {
        Self {
            id: ulid::Ulid::new().to_string(),
            name: "app.R".to_string(),
            slug: None,
            min_instances: 0,
            max_instances: 5,
            spawn_threshold: 80,
            inactive_timeout: 240,
            connection_timeout: 60,
        }
    }
}

JosiahParry avatar Jun 27 '24 00:06 JosiahParry