Skip to content

Commit

Permalink
Merge pull request #114 from ModProg/derive-hash
Browse files Browse the repository at this point in the history
feat: implement hash for types in check
  • Loading branch information
jeertmans authored Mar 11, 2024
2 parents 04eea4c + 8b9ca38 commit 6eb365a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/lib/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ where
}
}

#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize, Hash)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
/// A portion of text to be checked.
Expand Down Expand Up @@ -217,7 +217,7 @@ mod data_annotation_tests {
}

/// Alternative text to be checked.
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq)]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub struct Data {
/// Vector of markup text, see [`DataAnnotation`].
Expand Down Expand Up @@ -257,7 +257,7 @@ impl std::str::FromStr for Data {
///
/// Currently, `Level::Picky` adds additional rules
/// with respect to `Level::Default`.
#[derive(Clone, Default, Deserialize, Debug, PartialEq, Eq, Serialize)]
#[derive(Clone, Default, Deserialize, Debug, PartialEq, Eq, Serialize, Hash)]
#[cfg_attr(feature = "cli", derive(ValueEnum))]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
Expand Down Expand Up @@ -384,7 +384,7 @@ pub fn split_len<'source>(s: &'source str, n: usize, pat: &str) -> Vec<&'source
/// The structure below tries to follow as closely as possible the JSON API
/// described [here](https://languagetool.org/http-api/swagger-ui/#!/default/post_check).
#[cfg_attr(feature = "cli", derive(Args))]
#[derive(Clone, Deserialize, Debug, PartialEq, Eq, Serialize)]
#[derive(Clone, Deserialize, Debug, PartialEq, Eq, Serialize, Hash)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct CheckRequest {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/words.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn parse_word(v: &str) -> Result<String> {

/// Login arguments required by the API.
#[cfg_attr(feature = "cli", derive(Args))]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize, Hash)]
#[serde(rename_all = "camelCase")]
#[non_exhaustive]
pub struct LoginArgs {
Expand All @@ -53,7 +53,7 @@ pub struct LoginArgs {
///
/// List words in the user's personal dictionaries.
#[cfg_attr(feature = "cli", derive(Args))]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize, Hash)]
#[non_exhaustive]
pub struct WordsRequest {
/// Offset of where to start in the list of words.
Expand Down Expand Up @@ -117,7 +117,7 @@ impl From<WordsRequestArgs> for WordsRequest {
/// feature is considered to be used for personal dictionaries which must not
/// contain more than 500 words. If this is an issue for you, please contact us.
#[cfg_attr(feature = "cli", derive(Args))]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize, Hash)]
#[non_exhaustive]
pub struct WordsAddRequest {
/// The word to be added. Must not be a phrase, i.e., cannot contain white
Expand All @@ -141,7 +141,7 @@ pub struct WordsAddRequest {
///
/// Remove a word from one of the user's personal dictionaries.
#[cfg_attr(feature = "cli", derive(Args))]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Deserialize, Serialize, Hash)]
#[non_exhaustive]
pub struct WordsDeleteRequest {
/// The word to be removed.
Expand Down

0 comments on commit 6eb365a

Please sign in to comment.