Skip to content

Commit ed48b11

Browse files
committed
Update documentation references
Using rustdoc links (see RFC rust-lang/rfcs#1946)
1 parent 559f9e6 commit ed48b11

16 files changed

+144
-127
lines changed

src/error.rs

+14-12
Original file line numberDiff line numberDiff line change
@@ -96,56 +96,58 @@ pub enum Error {
9696
/// [`Thread::status`] can be used to check if the coroutine can be resumed without causing this
9797
/// error.
9898
///
99-
/// [`Thread::resume`]: struct.Thread.html#method.resume
100-
/// [`Thread::status`]: struct.Thread.html#method.status
99+
/// [`Thread::resume`]: crate::Thread::resume
100+
/// [`Thread::status`]: crate::Thread::status
101101
CoroutineInactive,
102102
/// An [`AnyUserData`] is not the expected type in a borrow.
103103
///
104104
/// This error can only happen when manually using [`AnyUserData`], or when implementing
105105
/// metamethods for binary operators. Refer to the documentation of [`UserDataMethods`] for
106106
/// details.
107107
///
108-
/// [`AnyUserData`]: struct.AnyUserData.html
109-
/// [`UserDataMethods`]: trait.UserDataMethods.html
108+
/// [`AnyUserData`]: crate::AnyUserData
109+
/// [`UserDataMethods`]: crate::UserDataMethods
110110
UserDataTypeMismatch,
111111
/// An [`AnyUserData`] borrow failed because it has been destructed.
112112
///
113113
/// This error can happen either due to to being destructed in a previous __gc, or due to being
114114
/// destructed from exiting a `Lua::scope` call.
115115
///
116-
/// [`AnyUserData`]: struct.AnyUserData.html
116+
/// [`AnyUserData`]: crate::AnyUserData
117117
UserDataDestructed,
118118
/// An [`AnyUserData`] immutable borrow failed because it is already borrowed mutably.
119119
///
120120
/// This error can occur when a method on a [`UserData`] type calls back into Lua, which then
121121
/// tries to call a method on the same [`UserData`] type. Consider restructuring your API to
122122
/// prevent these errors.
123123
///
124-
/// [`AnyUserData`]: struct.AnyUserData.html
125-
/// [`UserData`]: trait.UserData.html
124+
/// [`AnyUserData`]: crate::AnyUserData
125+
/// [`UserData`]: crate::UserData
126126
UserDataBorrowError,
127127
/// An [`AnyUserData`] mutable borrow failed because it is already borrowed.
128128
///
129129
/// This error can occur when a method on a [`UserData`] type calls back into Lua, which then
130130
/// tries to call a method on the same [`UserData`] type. Consider restructuring your API to
131131
/// prevent these errors.
132132
///
133-
/// [`AnyUserData`]: struct.AnyUserData.html
134-
/// [`UserData`]: trait.UserData.html
133+
/// [`AnyUserData`]: crate::AnyUserData
134+
/// [`UserData`]: crate::UserData
135135
UserDataBorrowMutError,
136136
/// A [`MetaMethod`] operation is restricted (typically for `__gc` or `__metatable`).
137137
///
138-
/// [`MetaMethod`]: enum.MetaMethod.html
138+
/// [`MetaMethod`]: crate::MetaMethod
139139
MetaMethodRestricted(StdString),
140140
/// A [`MetaMethod`] (eg. `__index` or `__newindex`) has invalid type.
141141
///
142-
/// [`MetaMethod`]: enum.MetaMethod.html
142+
/// [`MetaMethod`]: crate::MetaMethod
143143
MetaMethodTypeError {
144144
method: StdString,
145145
type_name: &'static str,
146146
message: Option<StdString>,
147147
},
148-
/// A `RegistryKey` produced from a different Lua state was used.
148+
/// A [`RegistryKey`] produced from a different Lua state was used.
149+
///
150+
/// [`RegistryKey`]: crate::RegistryKey
149151
MismatchedRegistryKey,
150152
/// A Rust callback returned `Err`, raising the contained `Error` as a Lua error.
151153
CallbackError {

src/function.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'lua> Function<'lua> {
116116
/// # }
117117
/// ```
118118
///
119-
/// [`AsyncThread`]: struct.AsyncThread.html
119+
/// [`AsyncThread`]: crate::AsyncThread
120120
#[cfg(feature = "async")]
121121
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
122122
pub fn call_async<'fut, A, R>(&self, args: A) -> LocalBoxFuture<'fut, Result<R>>

src/hook.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::util::callback_error;
1515
/// found in the [Lua 5.3 documentation][lua_doc].
1616
///
1717
/// [lua_doc]: https://www.lua.org/manual/5.3/manual.html#lua_Debug
18-
/// [`Lua::set_hook`]: struct.Lua.html#method.set_hook
18+
/// [`Lua::set_hook`]: crate::Lua::set_hook
1919
#[derive(Clone)]
2020
pub struct Debug<'a> {
2121
ar: *mut lua_Debug,

src/lib.rs

+23-23
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,24 @@
5050
//! to [`Function`]s and [`UserData`].
5151
//!
5252
//! [Lua programming language]: https://www.lua.org/
53-
//! [`Lua`]: struct.Lua.html
54-
//! [executing]: struct.Chunk.html#method.exec
55-
//! [evaluating]: struct.Chunk.html#method.eval
56-
//! [globals]: struct.Lua.html#method.globals
57-
//! [`ToLua`]: trait.ToLua.html
58-
//! [`FromLua`]: trait.FromLua.html
59-
//! [`ToLuaMulti`]: trait.ToLuaMulti.html
60-
//! [`FromLuaMulti`]: trait.FromLuaMulti.html
61-
//! [`Function`]: struct.Function.html
62-
//! [`UserData`]: trait.UserData.html
63-
//! [`UserDataFields`]: trait.UserDataFields.html
64-
//! [`UserDataMethods`]: trait.UserDataMethods.html
65-
//! [`LuaSerdeExt`]: serde/trait.LuaSerdeExt.html
66-
//! [`Value`]: enum.Value.html
67-
//! [`create_async_function`]: struct.Lua.html#method.create_async_function
68-
//! [`call_async`]: struct.Function.html#method.call_async
69-
//! [`AsyncThread`]: struct.AsyncThread.html
70-
//! [`Future`]: ../futures_core/future/trait.Future.html
53+
//! [`Lua`]: crate::Lua
54+
//! [executing]: crate::Chunk::exec
55+
//! [evaluating]: crate::Chunk::eval
56+
//! [globals]: crate::Lua::globals
57+
//! [`ToLua`]: crate::ToLua
58+
//! [`FromLua`]: crate::FromLua
59+
//! [`ToLuaMulti`]: crate::ToLuaMulti
60+
//! [`FromLuaMulti`]: crate::FromLuaMulti
61+
//! [`Function`]: crate::Function
62+
//! [`UserData`]: crate::UserData
63+
//! [`UserDataFields`]: crate::UserDataFields
64+
//! [`UserDataMethods`]: crate::UserDataMethods
65+
//! [`LuaSerdeExt`]: crate::LuaSerdeExt
66+
//! [`Value`]: crate::Value
67+
//! [`create_async_function`]: crate::Lua::create_async_function
68+
//! [`call_async`]: crate::Function::call_async
69+
//! [`AsyncThread`]: crate::AsyncThread
70+
//! [`Future`]: std::future::Future
7171
//! [`serde::Serialize`]: https://docs.serde.rs/serde/ser/trait.Serialize.html
7272
//! [`serde::Deserialize`]: https://docs.serde.rs/serde/de/trait.Deserialize.html
7373
@@ -98,6 +98,8 @@ mod userdata;
9898
mod util;
9999
mod value;
100100

101+
pub mod prelude;
102+
101103
pub use crate::{ffi::lua_CFunction, ffi::lua_State};
102104

103105
pub use crate::error::{Error, ExternalError, ExternalResult, Result};
@@ -120,13 +122,11 @@ pub use crate::value::{FromLua, FromLuaMulti, MultiValue, Nil, ToLua, ToLuaMulti
120122
pub use crate::thread::AsyncThread;
121123

122124
#[cfg(feature = "serialize")]
123-
#[cfg_attr(docsrs, doc(cfg(feature = "serialize")))]
124125
#[doc(inline)]
125126
pub use crate::serde::{
126127
de::Options as DeserializeOptions, ser::Options as SerializeOptions, LuaSerdeExt,
127128
};
128129

129-
pub mod prelude;
130130
#[cfg(feature = "serialize")]
131131
#[cfg_attr(docsrs, doc(cfg(feature = "serialize")))]
132132
pub mod serde;
@@ -185,9 +185,9 @@ extern crate mlua_derive;
185185
///
186186
/// Everything else should work.
187187
///
188-
/// [`AsChunk`]: trait.AsChunk.html
189-
/// [`UserData`]: trait.UserData.html
190-
/// [`ToLua`]: trait.ToLua.html
188+
/// [`AsChunk`]: crate::AsChunk
189+
/// [`UserData`]: crate::UserData
190+
/// [`ToLua`]: crate::ToLua
191191
#[cfg(any(feature = "macros"))]
192192
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
193193
pub use mlua_derive::chunk;

src/lua.rs

+23-22
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl Lua {
210210
///
211211
/// See [`StdLib`] documentation for a list of unsafe modules that cannot be loaded.
212212
///
213-
/// [`StdLib`]: struct.StdLib.html
213+
/// [`StdLib`]: crate::StdLib
214214
#[allow(clippy::new_without_default)]
215215
pub fn new() -> Lua {
216216
mlua_expect!(
@@ -237,7 +237,7 @@ impl Lua {
237237
///
238238
/// See [`StdLib`] documentation for a list of unsafe modules that cannot be loaded.
239239
///
240-
/// [`StdLib`]: struct.StdLib.html
240+
/// [`StdLib`]: crate::StdLib
241241
pub fn new_with(libs: StdLib, options: LuaOptions) -> Result<Lua> {
242242
if libs.contains(StdLib::DEBUG) {
243243
return Err(Error::SafetyError(
@@ -271,7 +271,7 @@ impl Lua {
271271
/// # Safety
272272
/// The created Lua state will not have safety guarantees and allow to load C modules.
273273
///
274-
/// [`StdLib`]: struct.StdLib.html
274+
/// [`StdLib`]: crate::StdLib
275275
pub unsafe fn unsafe_new_with(libs: StdLib, options: LuaOptions) -> Lua {
276276
ffi::keep_lua_symbols();
277277
Self::inner_new(libs, options)
@@ -513,7 +513,7 @@ impl Lua {
513513
///
514514
/// Use the [`StdLib`] flags to specify the libraries you want to load.
515515
///
516-
/// [`StdLib`]: struct.StdLib.html
516+
/// [`StdLib`]: crate::StdLib
517517
pub fn load_from_std_lib(&self, libs: StdLib) -> Result<()> {
518518
if self.safe && libs.contains(StdLib::DEBUG) {
519519
return Err(Error::SafetyError(
@@ -700,8 +700,8 @@ impl Lua {
700700
/// # }
701701
/// ```
702702
///
703-
/// [`HookTriggers`]: struct.HookTriggers.html
704-
/// [`HookTriggers.every_nth_instruction`]: struct.HookTriggers.html#field.every_nth_instruction
703+
/// [`HookTriggers`]: crate::HookTriggers
704+
/// [`HookTriggers.every_nth_instruction`]: crate::HookTriggers::every_nth_instruction
705705
pub fn set_hook<F>(&self, triggers: HookTriggers, callback: F) -> Result<()>
706706
where
707707
F: 'static + MaybeSend + FnMut(&Lua, Debug) -> Result<()>,
@@ -906,10 +906,11 @@ impl Lua {
906906
/// similar on the returned builder. Code is not even parsed until one of these methods is
907907
/// called.
908908
///
909-
/// If this `Lua` was created with `unsafe_new`, `load` will automatically detect and load
909+
/// If this `Lua` was created with [`unsafe_new`], `load` will automatically detect and load
910910
/// chunks of either text or binary type, as if passing `bt` mode to `luaL_loadbufferx`.
911911
///
912-
/// [`Chunk::exec`]: struct.Chunk.html#method.exec
912+
/// [`Chunk::exec`]: crate::Chunk::exec
913+
/// [`unsafe_new`]: #method.unsafe_new
913914
#[track_caller]
914915
pub fn load<'lua, 'a, S>(&'lua self, source: &'a S) -> Chunk<'lua, 'a>
915916
where
@@ -1105,8 +1106,8 @@ impl Lua {
11051106
/// # }
11061107
/// ```
11071108
///
1108-
/// [`ToLua`]: trait.ToLua.html
1109-
/// [`ToLuaMulti`]: trait.ToLuaMulti.html
1109+
/// [`ToLua`]: crate::ToLua
1110+
/// [`ToLuaMulti`]: crate::ToLuaMulti
11101111
pub fn create_function<'lua, 'callback, A, R, F>(&'lua self, func: F) -> Result<Function<'lua>>
11111112
where
11121113
'lua: 'callback,
@@ -1191,8 +1192,8 @@ impl Lua {
11911192
/// }
11921193
/// ```
11931194
///
1194-
/// [`Thread`]: struct.Thread.html
1195-
/// [`AsyncThread`]: struct.AsyncThread.html
1195+
/// [`Thread`]: crate::Thread
1196+
/// [`AsyncThread`]: crate::AsyncThread
11961197
#[cfg(feature = "async")]
11971198
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
11981199
pub fn create_async_function<'lua, 'callback, A, R, F, FR>(
@@ -1484,7 +1485,7 @@ impl Lua {
14841485
/// Be warned, garbage collection of values held inside the registry is not automatic, see
14851486
/// [`RegistryKey`] for more details.
14861487
///
1487-
/// [`RegistryKey`]: struct.RegistryKey.html
1488+
/// [`RegistryKey`]: crate::RegistryKey
14881489
pub fn create_registry_value<'lua, T: ToLua<'lua>>(&'lua self, t: T) -> Result<RegistryKey> {
14891490
let t = t.to_lua(self)?;
14901491
unsafe {
@@ -2206,7 +2207,7 @@ impl Lua {
22062207

22072208
/// Returned from [`Lua::load`] and is used to finalize loading and executing Lua main chunks.
22082209
///
2209-
/// [`Lua::load`]: struct.Lua.html#method.load
2210+
/// [`Lua::load`]: crate::Lua::load
22102211
#[must_use = "`Chunk`s do nothing unless one of `exec`, `eval`, `call`, or `into_function` are called on them"]
22112212
pub struct Chunk<'lua, 'a> {
22122213
lua: &'lua Lua,
@@ -2226,7 +2227,7 @@ pub enum ChunkMode {
22262227
/// Trait for types [loadable by Lua] and convertible to a [`Chunk`]
22272228
///
22282229
/// [loadable by Lua]: https://www.lua.org/manual/5.3/manual.html#3.3.2
2229-
/// [`Chunk`]: struct.Chunk.html
2230+
/// [`Chunk`]: crate::Chunk
22302231
pub trait AsChunk<'lua> {
22312232
/// Returns chunk data (can be text or binary)
22322233
fn source(&self) -> &[u8];
@@ -2284,7 +2285,7 @@ impl<'lua, 'a> Chunk<'lua, 'a> {
22842285
/// Lua does not check the consistency of binary chunks, therefore this mode is allowed only
22852286
/// for instances created with [`Lua::unsafe_new`].
22862287
///
2287-
/// [`Lua::unsafe_new`]: struct.Lua.html#method.unsafe_new
2288+
/// [`Lua::unsafe_new`]: crate::Lua::unsafe_new
22882289
pub fn set_mode(mut self, mode: ChunkMode) -> Chunk<'lua, 'a> {
22892290
self.mode = Some(mode);
22902291
self
@@ -2300,11 +2301,11 @@ impl<'lua, 'a> Chunk<'lua, 'a> {
23002301

23012302
/// Asynchronously execute this chunk of code.
23022303
///
2303-
/// See [`Chunk::exec`] for more details.
2304+
/// See [`exec`] for more details.
23042305
///
23052306
/// Requires `feature = "async"`
23062307
///
2307-
/// [`Chunk::exec`]: struct.Chunk.html#method.exec
2308+
/// [`exec`]: #method.exec
23082309
#[cfg(feature = "async")]
23092310
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
23102311
pub fn exec_async<'fut>(self) -> LocalBoxFuture<'fut, Result<()>>
@@ -2340,11 +2341,11 @@ impl<'lua, 'a> Chunk<'lua, 'a> {
23402341

23412342
/// Asynchronously evaluate the chunk as either an expression or block.
23422343
///
2343-
/// See [`Chunk::eval`] for more details.
2344+
/// See [`eval`] for more details.
23442345
///
23452346
/// Requires `feature = "async"`
23462347
///
2347-
/// [`Chunk::eval`]: struct.Chunk.html#method.eval
2348+
/// [`eval`]: #method.eval
23482349
#[cfg(feature = "async")]
23492350
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
23502351
pub fn eval_async<'fut, R>(self) -> LocalBoxFuture<'fut, Result<R>>
@@ -2378,11 +2379,11 @@ impl<'lua, 'a> Chunk<'lua, 'a> {
23782379

23792380
/// Load the chunk function and asynchronously call it with the given arguments.
23802381
///
2381-
/// See [`Chunk::call`] for more details.
2382+
/// See [`call`] for more details.
23822383
///
23832384
/// Requires `feature = "async"`
23842385
///
2385-
/// [`Chunk::call`]: struct.Chunk.html#method.call
2386+
/// [`call`]: #method.call
23862387
#[cfg(feature = "async")]
23872388
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
23882389
pub fn call_async<'fut, A, R>(self, args: A) -> LocalBoxFuture<'fut, Result<R>>

src/multi.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ impl<'lua> FromLuaMulti<'lua> for MultiValue<'lua> {
7676
/// # }
7777
/// ```
7878
///
79-
/// [`FromLua`]: trait.FromLua.html
80-
/// [`MultiValue`]: struct.MultiValue.html
79+
/// [`FromLua`]: crate::FromLua
80+
/// [`MultiValue`]: crate::MultiValue
8181
#[derive(Debug, Clone)]
8282
pub struct Variadic<T>(Vec<T>);
8383

src/prelude.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Re-exports most types with an extra `Lua*` prefix to prevent name clashes.
22
3+
#[doc(no_inline)]
34
pub use crate::{
45
AnyUserData as LuaAnyUserData, Chunk as LuaChunk, Error as LuaError,
56
ExternalError as LuaExternalError, ExternalResult as LuaExternalResult, FromLua, FromLuaMulti,
@@ -14,10 +15,11 @@ pub use crate::{
1415
};
1516

1617
#[cfg(feature = "async")]
18+
#[doc(no_inline)]
1719
pub use crate::AsyncThread as LuaAsyncThread;
1820

1921
#[cfg(feature = "serialize")]
20-
#[doc(inline)]
22+
#[doc(no_inline)]
2123
pub use crate::{
2224
DeserializeOptions as LuaDeserializeOptions, LuaSerdeExt,
2325
SerializeOptions as LuaSerializeOptions,

0 commit comments

Comments
 (0)