diff --git a/source/lib.rs b/source/lib.rs index 0b85abf..abbd3d0 100644 --- a/source/lib.rs +++ b/source/lib.rs @@ -26,12 +26,14 @@ #[derive(Debug)] pub struct Generator { pub base_url: String, + pub image_size: Option, } impl Default for Generator { fn default() -> Self { Self { base_url: "www.gravatar.com".to_string(), + image_size: None, } } } @@ -80,4 +82,19 @@ impl Generator { ..self } } + + /// Configures the Generator to include a `s=` in the URL. + /// + /// ```rust + /// use gravatar_rs::Generator; + /// + /// // Get 128px images instead of the default 80px. + /// Generator::default().set_image_size(128); + /// ``` + pub fn set_image_size(self, image_size: i32) -> Self { + Self { + image_size: Some(image_size), + ..self + } + } }