Update deprecated methods with since attribute.

This commit is contained in:
Stephen Chung 2021-03-28 17:04:16 +08:00
parent 7825cb1c56
commit 8e8c367034
3 changed files with 28 additions and 18 deletions

View File

@ -859,12 +859,10 @@ impl Engine {
self self
} }
/// Register a shared [`Module`] into the global namespace of [`Engine`]. /// Register a shared [`Module`] into the global namespace of [`Engine`].
/// /// This function is deprecated and will be removed in the future.
/// # Deprecated
///
/// Use [`register_global_module`][Engine::register_global_module] instead. /// Use [`register_global_module`][Engine::register_global_module] instead.
#[inline(always)] #[inline(always)]
#[deprecated = "use `register_global_module` instead"] #[deprecated(since = "0.19.9", note = "use `register_global_module` instead")]
pub fn load_package(&mut self, module: impl Into<Shared<Module>>) -> &mut Self { pub fn load_package(&mut self, module: impl Into<Shared<Module>>) -> &mut Self {
self.register_global_module(module.into()) self.register_global_module(module.into())
} }
@ -947,13 +945,11 @@ impl Engine {
} }
/// Register a shared [`Module`] as a static module namespace with the [`Engine`]. /// Register a shared [`Module`] as a static module namespace with the [`Engine`].
/// /// This function is deprecated and will be removed in the future.
/// # Deprecated
///
/// Use [`register_static_module`][Engine::register_static_module] instead. /// Use [`register_static_module`][Engine::register_static_module] instead.
#[cfg(not(feature = "no_module"))] #[cfg(not(feature = "no_module"))]
#[inline(always)] #[inline(always)]
#[deprecated = "use `register_static_module` instead"] #[deprecated(since = "0.19.9", note = "use `register_static_module` instead")]
pub fn register_module( pub fn register_module(
&mut self, &mut self,
name: impl AsRef<str> + Into<ImmutableString>, name: impl AsRef<str> + Into<ImmutableString>,

View File

@ -135,6 +135,22 @@ pub use syntax::Expression;
pub use token::Position; pub use token::Position;
pub use utils::ImmutableString; pub use utils::ImmutableString;
/// A trait to enable registering Rust functions.
/// This trait is no longer needed and will be removed in the future.
#[deprecated(
since = "0.19.15",
note = "this trait is no longer needed and will be removed in the future"
)]
pub trait RegisterFn {}
/// A trait to enable registering Rust functions.
/// This trait is no longer needed and will be removed in the future.
#[deprecated(
since = "0.19.15",
note = "this trait is no longer needed and will be removed in the future"
)]
pub trait RegisterResultFn {}
/// Alias to [`Rc`][std::rc::Rc] or [`Arc`][std::sync::Arc] depending on the `sync` feature flag. /// Alias to [`Rc`][std::rc::Rc] or [`Arc`][std::sync::Arc] depending on the `sync` feature flag.
pub use fn_native::Shared; pub use fn_native::Shared;
@ -208,9 +224,9 @@ pub use engine::Limits;
pub use module::NamespaceRef; pub use module::NamespaceRef;
/// Alias to [`smallvec::SmallVec<[T; 4]>`](https://crates.io/crates/smallvec), which is a /// Alias to [`smallvec::SmallVec<[T; 4]>`](https://crates.io/crates/smallvec), which is a
/// specialized [`Vec`] backed by a small, inline, fixed-size array when there are <= 4 items stored. /// specialized [`Vec`] backed by a small, inline, fixed-size array when there are 4 items stored.
/// ///
/// # Background /// # History
/// ///
/// And Saint Attila raised the `SmallVec` up on high, saying, "O Lord, bless this Thy `SmallVec` /// And Saint Attila raised the `SmallVec` up on high, saying, "O Lord, bless this Thy `SmallVec`
/// that, with it, Thou mayest blow Thine allocation costs to tiny bits in Thy mercy." /// that, with it, Thou mayest blow Thine allocation costs to tiny bits in Thy mercy."
@ -235,17 +251,17 @@ pub use module::NamespaceRef;
/// in that matter) contain fewer than 5 arguments, the exception being closures that capture a /// in that matter) contain fewer than 5 arguments, the exception being closures that capture a
/// large number of external variables. /// large number of external variables.
/// ///
/// In addition, most scripts blocks either contain many statements, or just a few lines; /// In addition, most script blocks either contain many statements, or just a few lines;
/// most scripts load fewer than 5 external modules; most module paths contain fewer than 5 levels /// most scripts load fewer than 5 external modules; most module paths contain fewer than 5 levels
/// (e.g. `std::collections::map::HashMap` is 4 levels, and that's already quite long). /// (e.g. `std::collections::map::HashMap` is 4 levels, and that's already quite long).
#[cfg(not(feature = "internals"))] #[cfg(not(feature = "internals"))]
type StaticVec<T> = smallvec::SmallVec<[T; 4]>; type StaticVec<T> = smallvec::SmallVec<[T; 4]>;
/// _(INTERNALS)_ Alias to [`smallvec`](https://crates.io/crates/smallvec), which is a specialized /// _(INTERNALS)_ Alias to [`smallvec`](https://crates.io/crates/smallvec), which is a specialized
/// [`Vec`] backed by a small, inline, fixed-size array when there are <= 4 items stored. /// [`Vec`] backed by a small, inline, fixed-size array when there are 4 items stored.
/// Exported under the `internals` feature only. /// Exported under the `internals` feature only.
/// ///
/// # Background /// # History
/// ///
/// And Saint Attila raised the `SmallVec` up on high, saying, "O Lord, bless this Thy `SmallVec` /// And Saint Attila raised the `SmallVec` up on high, saying, "O Lord, bless this Thy `SmallVec`
/// that, with it, Thou mayest blow Thine allocation costs to tiny bits in Thy mercy." /// that, with it, Thou mayest blow Thine allocation costs to tiny bits in Thy mercy."
@ -270,7 +286,7 @@ type StaticVec<T> = smallvec::SmallVec<[T; 4]>;
/// in that matter) contain fewer than 5 arguments, the exception being closures that capture a /// in that matter) contain fewer than 5 arguments, the exception being closures that capture a
/// large number of external variables. /// large number of external variables.
/// ///
/// In addition, most scripts blocks either contain many statements, or just a few lines; /// In addition, most script blocks either contain many statements, or just a few lines;
/// most scripts load fewer than 5 external modules; most module paths contain fewer than 5 levels /// most scripts load fewer than 5 external modules; most module paths contain fewer than 5 levels
/// (e.g. `std::collections::map::HashMap` is 4 levels, and that's already quite long). /// (e.g. `std::collections::map::HashMap` is 4 levels, and that's already quite long).
#[cfg(feature = "internals")] #[cfg(feature = "internals")]

View File

@ -40,11 +40,9 @@ pub trait Package {
fn as_shared_module(&self) -> Shared<Module>; fn as_shared_module(&self) -> Shared<Module>;
/// Retrieve the generic package library from this package. /// Retrieve the generic package library from this package.
/// /// This method is deprecated and will be removed in the future.
/// # Deprecated
///
/// Use [`as_shared_module`][Package::as_shared_module] instead. /// Use [`as_shared_module`][Package::as_shared_module] instead.
#[deprecated = "use `as_shared_module` instead"] #[deprecated(since = "0.19.9", note = "use `as_shared_module` instead")]
fn get(&self) -> Shared<Module> { fn get(&self) -> Shared<Module> {
self.as_shared_module() self.as_shared_module()
} }