From 7b010a655bb4fecb2f455ab4a63e9eafe6853bf0 Mon Sep 17 00:00:00 2001 From: Bauke Date: Sat, 2 Apr 2022 22:16:20 +0200 Subject: [PATCH] Add documentation warnings and forbid unsafe code. --- source/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/lib.rs b/source/lib.rs index 1f378bd..dc41911 100644 --- a/source/lib.rs +++ b/source/lib.rs @@ -1,3 +1,6 @@ +#![forbid(unsafe_code)] +#![warn(missing_docs, clippy::missing_docs_in_private_items)] + //! # gravatar-rs //! //! This crate provides an API for creating [Gravatar image URLs], and by @@ -25,11 +28,32 @@ /// A generator for Gravatar image URLs. #[derive(Debug)] pub struct Generator { + /// The base URL for images, defaults to `www.gravatar.com`. pub base_url: String, + + /// Which default image to use when there is no matching Gravatar, defaults + /// to `None`. + /// + /// See the [Gravatar documentation] for all the possible ways to use it. + /// + /// [Gravatar documentation]: https://gravatar.com/site/implement/images/#default-image pub default_image: Option, + + /// Whether you always want the default image to be returned, defaults to + /// `false`. pub force_default: bool, + + /// A custom size for images, defaults to `None`. pub image_size: Option, + + /// Whether to include `.jpg` in the image URL, defaults to false. pub include_file_extension: bool, + + /// Which rating should be allowed, defaults to `None`. + /// + /// See the [Gravatar documentation] for all the possible ratings. + /// + /// [Gravatar documentation]: https://gravatar.com/site/implement/images/#rating pub rating: Option, }