Mark some types as non_exhaustive.

This commit is contained in:
Stephen Chung 2022-05-03 21:55:08 +08:00
parent 516f5a82a0
commit 2a57bd9d25
5 changed files with 8 additions and 2 deletions

View File

@ -15,11 +15,12 @@ Script-breaking changes
* _Strict Variables Mode_ no longer returns an error when an undeclared variable matches a variable/constant in the provided external `Scope`.
Changes to unstable API's
-------------------------
Potentially breaking API changes
--------------------------------
* The `Engine::on_var` and `Engine::on_parse_token` API's are now marked unstable/volatile.
* The closures passed to `Engine::on_var`, `Engine::on_def_var` and `Engine::register_debugger` take `EvalContext` instead of `&EvalContext` or `&mut EvalContext`.
* The following enum's are marked `non_exhaustive`: `AccessMode`, `FnAccess`, `FnNamespace`, `FnMetadata`, `OptimizationLevel`
New API
-------

View File

@ -6,6 +6,7 @@ use std::prelude::v1::*;
/// A type representing the access mode of a function.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[non_exhaustive]
pub enum FnAccess {
/// Private function.
Private,

View File

@ -23,6 +23,7 @@ use std::{
/// A type representing the namespace of a function.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[non_exhaustive]
pub enum FnNamespace {
/// Module namespace only.
///
@ -34,6 +35,7 @@ pub enum FnNamespace {
/// A type containing all metadata for a registered function.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
#[non_exhaustive]
pub struct FnMetadata {
/// Function namespace.
pub namespace: FnNamespace,

View File

@ -23,6 +23,7 @@ use std::{
/// Level of optimization performed.
#[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum OptimizationLevel {
/// No optimization performed.
None,

View File

@ -127,6 +127,7 @@ impl dyn Variant {
/// _(internals)_ Modes of access.
/// Exported under the `internals` feature only.
#[derive(Debug, Eq, PartialEq, Hash, Copy, Clone)]
#[non_exhaustive]
pub enum AccessMode {
/// Mutable.
ReadWrite,