Skip to content

Commit 93adfa4

Browse files
committed
Update doc comments
1 parent 5dc6c32 commit 93adfa4

File tree

10 files changed

+37
-107
lines changed

10 files changed

+37
-107
lines changed

src/chunk.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,6 @@ impl Chunk<'_> {
482482
/// Sets or overwrites a Luau compiler used for this chunk.
483483
///
484484
/// See [`Compiler`] for details and possible options.
485-
///
486-
/// Requires `feature = "luau"`
487485
#[cfg(any(feature = "luau", doc))]
488486
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
489487
pub fn set_compiler(mut self, compiler: Compiler) -> Self {
@@ -502,8 +500,6 @@ impl Chunk<'_> {
502500
///
503501
/// See [`exec`] for more details.
504502
///
505-
/// Requires `feature = "async"`
506-
///
507503
/// [`exec`]: Chunk::exec
508504
#[cfg(feature = "async")]
509505
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
@@ -534,8 +530,6 @@ impl Chunk<'_> {
534530
///
535531
/// See [`eval`] for more details.
536532
///
537-
/// Requires `feature = "async"`
538-
///
539533
/// [`eval`]: Chunk::eval
540534
#[cfg(feature = "async")]
541535
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
@@ -563,8 +557,6 @@ impl Chunk<'_> {
563557
///
564558
/// See [`call`] for more details.
565559
///
566-
/// Requires `feature = "async"`
567-
///
568560
/// [`call`]: Chunk::call
569561
#[cfg(feature = "async")]
570562
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]

src/function.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ impl Function {
134134
/// Internally it wraps the function to an [`AsyncThread`]. The returned type implements
135135
/// `Future<Output = Result<R>>` and can be awaited.
136136
///
137-
/// Requires `feature = "async"`
138-
///
139137
/// # Examples
140138
///
141139
/// ```
@@ -433,8 +431,6 @@ impl Function {
433431
///
434432
/// Recording of coverage information is controlled by [`Compiler::set_coverage_level`] option.
435433
///
436-
/// Requires `feature = "luau"`
437-
///
438434
/// [`Compiler::set_coverage_level`]: crate::chunk::Compiler::set_coverage_level
439435
#[cfg(any(feature = "luau", doc))]
440436
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
@@ -494,8 +490,6 @@ impl Function {
494490
/// Copies the function prototype and all its upvalues to the
495491
/// newly created function.
496492
/// This function returns shallow clone (same handle) for Rust/C functions.
497-
///
498-
/// Requires `feature = "luau"`
499493
#[cfg(any(feature = "luau", doc))]
500494
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
501495
pub fn deep_clone(&self) -> Self {

src/hook.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,18 @@ pub struct DebugStack {
265265
/// Number of upvalues.
266266
pub num_ups: u8,
267267
/// Number of parameters.
268-
///
269-
/// Requires `feature = "lua54/lua53/lua52/luau"`
270268
#[cfg(any(feature = "lua54", feature = "lua53", feature = "lua52", feature = "luau"))]
269+
#[cfg_attr(
270+
docsrs,
271+
doc(cfg(any(feature = "lua54", feature = "lua53", feature = "lua52", feature = "luau")))
272+
)]
271273
pub num_params: u8,
272274
/// Whether the function is a vararg function.
273-
///
274-
/// Requires `feature = "lua54/lua53/lua52/luau"`
275275
#[cfg(any(feature = "lua54", feature = "lua53", feature = "lua52", feature = "luau"))]
276+
#[cfg_attr(
277+
docsrs,
278+
doc(cfg(any(feature = "lua54", feature = "lua53", feature = "lua52", feature = "luau")))
279+
)]
276280
pub is_vararg: bool,
277281
}
278282

src/serde/mod.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ use crate::value::Value;
1717
pub trait LuaSerdeExt: Sealed {
1818
/// A special value (lightuserdata) to encode/decode optional (none) values.
1919
///
20-
/// Requires `feature = "serialize"`
21-
///
2220
/// # Example
2321
///
2422
/// ```
@@ -42,8 +40,6 @@ pub trait LuaSerdeExt: Sealed {
4240
/// As result, encoded Array will contain only sequence part of the table, with the same length
4341
/// as the `#` operator on that table.
4442
///
45-
/// Requires `feature = "serialize"`
46-
///
4743
/// # Example
4844
///
4945
/// ```
@@ -71,8 +67,6 @@ pub trait LuaSerdeExt: Sealed {
7167

7268
/// Converts `T` into a [`Value`] instance.
7369
///
74-
/// Requires `feature = "serialize"`
75-
///
7670
/// [`Value`]: crate::Value
7771
///
7872
/// # Example
@@ -104,8 +98,6 @@ pub trait LuaSerdeExt: Sealed {
10498

10599
/// Converts `T` into a [`Value`] instance with options.
106100
///
107-
/// Requires `feature = "serialize"`
108-
///
109101
/// # Example
110102
///
111103
/// ```
@@ -129,8 +121,6 @@ pub trait LuaSerdeExt: Sealed {
129121

130122
/// Deserializes a [`Value`] into any serde deserializable object.
131123
///
132-
/// Requires `feature = "serialize"`
133-
///
134124
/// # Example
135125
///
136126
/// ```
@@ -158,8 +148,6 @@ pub trait LuaSerdeExt: Sealed {
158148

159149
/// Deserializes a [`Value`] into any serde deserializable object with options.
160150
///
161-
/// Requires `feature = "serialize"`
162-
///
163151
/// # Example
164152
///
165153
/// ```

src/state.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ pub(crate) struct LuaGuard(ArcReentrantMutexGuard<RawLua>);
7474
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7575
pub enum GCMode {
7676
Incremental,
77-
/// Requires `feature = "lua54"`
7877
#[cfg(feature = "lua54")]
7978
#[cfg_attr(docsrs, doc(cfg(feature = "lua54")))]
8079
Generational,
@@ -511,8 +510,6 @@ impl Lua {
511510
/// # #[cfg(not(feature = "luau"))]
512511
/// # fn main() {}
513512
/// ```
514-
///
515-
/// Requires `feature = "luau"`
516513
#[cfg(any(feature = "luau", doc))]
517514
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
518515
pub fn sandbox(&self, enabled: bool) -> Result<()> {
@@ -812,8 +809,6 @@ impl Lua {
812809
}
813810

814811
/// Sets the warning function to be used by Lua to emit warnings.
815-
///
816-
/// Requires `feature = "lua54"`
817812
#[cfg(feature = "lua54")]
818813
#[cfg_attr(docsrs, doc(cfg(feature = "lua54")))]
819814
pub fn set_warning_function<F>(&self, callback: F)
@@ -847,8 +842,6 @@ impl Lua {
847842
/// Removes warning function previously set by `set_warning_function`.
848843
///
849844
/// This function has no effect if a warning function was not previously set.
850-
///
851-
/// Requires `feature = "lua54"`
852845
#[cfg(feature = "lua54")]
853846
#[cfg_attr(docsrs, doc(cfg(feature = "lua54")))]
854847
pub fn remove_warning_function(&self) {
@@ -863,8 +856,6 @@ impl Lua {
863856
///
864857
/// A message in a call with `incomplete` set to `true` should be continued in
865858
/// another call to this function.
866-
///
867-
/// Requires `feature = "lua54"`
868859
#[cfg(feature = "lua54")]
869860
#[cfg_attr(docsrs, doc(cfg(feature = "lua54")))]
870861
pub fn warning(&self, msg: impl AsRef<str>, incomplete: bool) {
@@ -939,8 +930,6 @@ impl Lua {
939930
}
940931

941932
/// Returns `true` if the garbage collector is currently running automatically.
942-
///
943-
/// Requires `feature = "lua54/lua53/lua52/luau"`
944933
#[cfg(any(feature = "lua54", feature = "lua53", feature = "lua52", feature = "luau"))]
945934
pub fn gc_is_running(&self) -> bool {
946935
let lua = self.lock();
@@ -1078,8 +1067,6 @@ impl Lua {
10781067
/// Returns the previous mode. More information about the generational GC
10791068
/// can be found in the Lua 5.4 [documentation][lua_doc].
10801069
///
1081-
/// Requires `feature = "lua54"`
1082-
///
10831070
/// [lua_doc]: https://www.lua.org/manual/5.4/manual.html#2.5.2
10841071
#[cfg(feature = "lua54")]
10851072
#[cfg_attr(docsrs, doc(cfg(feature = "lua54")))]
@@ -1100,8 +1087,6 @@ impl Lua {
11001087
/// including via `require` function.
11011088
///
11021089
/// See [`Compiler`] for details and possible options.
1103-
///
1104-
/// Requires `feature = "luau"`
11051090
#[cfg(any(feature = "luau", doc))]
11061091
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
11071092
pub fn set_compiler(&self, compiler: Compiler) {
@@ -1176,8 +1161,6 @@ impl Lua {
11761161

11771162
/// Create and return a Luau [buffer] object from a byte slice of data.
11781163
///
1179-
/// Requires `feature = "luau"`
1180-
///
11811164
/// [buffer]: https://luau.org/library#buffer-library
11821165
#[cfg(any(feature = "luau", doc))]
11831166
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
@@ -1342,8 +1325,6 @@ impl Lua {
13421325
///
13431326
/// The family of `call_async()` functions takes care about creating [`Thread`].
13441327
///
1345-
/// Requires `feature = "async"`
1346-
///
13471328
/// # Examples
13481329
///
13491330
/// Non blocking sleep:
@@ -1409,8 +1390,6 @@ impl Lua {
14091390
}
14101391

14111392
/// Creates a Lua userdata object from a custom serializable userdata type.
1412-
///
1413-
/// Requires `feature = "serialize"`
14141393
#[cfg(feature = "serialize")]
14151394
#[cfg_attr(docsrs, doc(cfg(feature = "serialize")))]
14161395
#[inline]
@@ -1439,8 +1418,6 @@ impl Lua {
14391418
/// Creates a Lua userdata object from a custom serializable Rust type.
14401419
///
14411420
/// See [`Lua::create_any_userdata`] for more details.
1442-
///
1443-
/// Requires `feature = "serialize"`
14441421
#[cfg(feature = "serialize")]
14451422
#[cfg_attr(docsrs, doc(cfg(feature = "serialize")))]
14461423
#[inline]

src/stdlib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ pub struct StdLib(u32);
66

77
impl StdLib {
88
/// [`coroutine`](https://www.lua.org/manual/5.4/manual.html#6.2) library
9-
///
10-
/// Requires `feature = "lua54/lua53/lua52/luau"`
119
#[cfg(any(feature = "lua54", feature = "lua53", feature = "lua52", feature = "luau"))]
10+
#[cfg_attr(
11+
docsrs,
12+
doc(cfg(any(feature = "lua54", feature = "lua53", feature = "lua52", feature = "luau")))
13+
)]
1214
pub const COROUTINE: StdLib = StdLib(1);
1315

1416
/// [`table`](https://www.lua.org/manual/5.4/manual.html#6.6) library
@@ -26,15 +28,16 @@ impl StdLib {
2628
pub const STRING: StdLib = StdLib(1 << 4);
2729

2830
/// [`utf8`](https://www.lua.org/manual/5.4/manual.html#6.5) library
29-
///
30-
/// Requires `feature = "lua54/lua53/luau"`
3131
#[cfg(any(feature = "lua54", feature = "lua53", feature = "luau"))]
32+
#[cfg_attr(docsrs, doc(cfg(any(feature = "lua54", feature = "lua53", feature = "luau"))))]
3233
pub const UTF8: StdLib = StdLib(1 << 5);
3334

3435
/// [`bit`](https://www.lua.org/manual/5.2/manual.html#6.7) library
35-
///
36-
/// Requires `feature = "lua52/luajit/luau"`
3736
#[cfg(any(feature = "lua52", feature = "luajit", feature = "luau", doc))]
37+
#[cfg_attr(
38+
docsrs,
39+
doc(cfg(any(feature = "lua52", feature = "luajit", feature = "luau")))
40+
)]
3841
pub const BIT: StdLib = StdLib(1 << 6);
3942

4043
/// [`math`](https://www.lua.org/manual/5.4/manual.html#6.7) library
@@ -56,15 +59,11 @@ impl StdLib {
5659
pub const VECTOR: StdLib = StdLib(1 << 10);
5760

5861
/// [`jit`](http://luajit.org/ext_jit.html) library
59-
///
60-
/// Requires `feature = "luajit"`
6162
#[cfg(any(feature = "luajit", doc))]
6263
#[cfg_attr(docsrs, doc(cfg(feature = "luajit")))]
6364
pub const JIT: StdLib = StdLib(1 << 11);
6465

6566
/// (**unsafe**) [`ffi`](http://luajit.org/ext_ffi.html) library
66-
///
67-
/// Requires `feature = "luajit"`
6867
#[cfg(any(feature = "luajit", doc))]
6968
#[cfg_attr(docsrs, doc(cfg(feature = "luajit")))]
7069
pub const FFI: StdLib = StdLib(1 << 30);

src/table.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,6 @@ impl Table {
537537
}
538538

539539
/// Sets `readonly` attribute on the table.
540-
///
541-
/// Requires `feature = "luau"`
542540
#[cfg(any(feature = "luau", doc))]
543541
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
544542
pub fn set_readonly(&self, enabled: bool) {
@@ -554,8 +552,6 @@ impl Table {
554552
}
555553

556554
/// Returns `readonly` attribute of the table.
557-
///
558-
/// Requires `feature = "luau"`
559555
#[cfg(any(feature = "luau", doc))]
560556
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
561557
pub fn is_readonly(&self) -> bool {
@@ -573,8 +569,6 @@ impl Table {
573569
/// - Fast-path for some built-in functions (fastcall).
574570
///
575571
/// For `safeenv` environments, monkey patching or modifying values may not work as expected.
576-
///
577-
/// Requires `feature = "luau"`
578572
#[cfg(any(feature = "luau", doc))]
579573
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
580574
pub fn set_safeenv(&self, enabled: bool) {

src/thread.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ unsafe impl Sync for Thread {}
7979

8080
/// Thread (coroutine) representation as an async [`Future`] or [`Stream`].
8181
///
82-
/// Requires `feature = "async"`
83-
///
8482
/// [`Future`]: std::future::Future
8583
/// [`Stream`]: futures_util::stream::Stream
8684
#[cfg(feature = "async")]
@@ -356,8 +354,6 @@ impl Thread {
356354
/// values whereas [`Future`] version discards that values and poll until the final
357355
/// one (returned from the thread function).
358356
///
359-
/// Requires `feature = "async"`
360-
///
361357
/// [`Future`]: std::future::Future
362358
/// [`Stream`]: futures_util::stream::Stream
363359
/// [`resume`]: https://www.lua.org/manual/5.4/manual.html#lua_resume
@@ -455,8 +451,6 @@ impl Thread {
455451
/// # #[cfg(not(feature = "luau"))]
456452
/// # fn main() { }
457453
/// ```
458-
///
459-
/// Requires `feature = "luau"`
460454
#[cfg(any(feature = "luau", doc))]
461455
#[cfg_attr(docsrs, doc(cfg(feature = "luau")))]
462456
#[doc(hidden)]

src/traits.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ pub trait ObjectLike: Sealed {
175175
/// Gets the function associated to key `name` from the object and asynchronously calls it,
176176
/// passing the object itself along with `args` as function arguments.
177177
///
178-
/// Requires `feature = "async"`
179-
///
180178
/// This might invoke the `__index` metamethod.
181179
#[cfg(feature = "async")]
182180
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]
@@ -195,8 +193,6 @@ pub trait ObjectLike: Sealed {
195193
/// Gets the function associated to key `name` from the object and asynchronously calls it,
196194
/// passing `args` as function arguments.
197195
///
198-
/// Requires `feature = "async"`
199-
///
200196
/// This might invoke the `__index` metamethod.
201197
#[cfg(feature = "async")]
202198
#[cfg_attr(docsrs, doc(cfg(feature = "async")))]

0 commit comments

Comments
 (0)