Derive Hash for Language

Given Language implements Eq, it can probably implement Hash too.

This makes it easy to derive a random identifier from a `Language`
This commit is contained in:
Léo Gaspard 2023-02-09 03:35:42 +01:00 committed by GitHub
parent 5766b8a0a7
commit 3964651fc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ pub const PARSER_HEADER: &'static str = include_str!("../include/tree_sitter/par
/// An opaque object that defines how to parse a particular language. The code for each
/// `Language` is generated by the Tree-sitter CLI.
#[doc(alias = "TSLanguage")]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(transparent)]
pub struct Language(*const ffi::TSLanguage);