#[allow(non_camel_case_types)]
#[derive(Debug, Clone, PartialEq)]
pub struct CT_Image {
pub id: u32,
pub boundary: String,
pub resource_id: u32,
pub interpolate: bool,
}
impl CT_Image {
#[must_use]
pub fn new(id: u32, boundary: impl Into<String>, resource_id: u32) -> Self {
Self {
id,
boundary: boundary.into(),
resource_id,
interpolate: false,
}
}
#[must_use]
pub fn interpolate(mut self, interpolate: bool) -> Self {
self.interpolate = interpolate;
self
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn ct_image_new() {
let img = CT_Image::new(1, "0 0 100 100", 5);
assert_eq!(img.id, 1);
assert_eq!(img.resource_id, 5);
assert!(!img.interpolate);
}
#[test]
fn ct_image_builder() {
let img = CT_Image::new(2, "10 20 50 50", 3).interpolate(true);
assert!(img.interpolate);
}
}