More sensible defaults for Transfer struct

This commit is contained in:
Emilia Allison 2023-06-08 10:56:42 -04:00
parent 2579f2e965
commit 768b88a562
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
1 changed files with 14 additions and 1 deletions

View File

@ -4,7 +4,7 @@ use serde::Deserialize;
use serde::Serialize;
use uuid::Uuid;
#[derive(PartialEq, Clone, Default, Debug, Serialize, Deserialize)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Transfer {
pub source_id: Uuid,
@ -16,6 +16,19 @@ pub struct Transfer {
pub volume: f32,
}
impl Default for Transfer {
fn default() -> Self {
Transfer {
source_id: Default::default(),
dest_id: Default::default(),
name: "New Transfer".to_string(),
id: Default::default(),
transfer_region: Default::default(),
volume: 2.5f32,
}
}
}
fn default_volume() -> f32 {
2.5f32
}