Skip to content

Commit 9ae3cb0

Browse files
committed
Add doc about possible chunk name prefixes
1 parent fc1c80c commit 9ae3cb0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/chunk.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ use crate::value::Value;
1919
/// [loadable by Lua]: https://www.lua.org/manual/5.4/manual.html#3.3.2
2020
pub trait AsChunk<'a> {
2121
/// Returns optional chunk name
22+
///
23+
/// See [`Chunk::set_name`] for possible name prefixes.
2224
fn name(&self) -> Option<StdString> {
2325
None
2426
}
@@ -306,6 +308,11 @@ impl Compiler {
306308

307309
impl Chunk<'_> {
308310
/// Sets the name of this chunk, which results in more informative error traces.
311+
///
312+
/// Possible name prefixes:
313+
/// - `@` - file path (when truncation is needed, the end of the file path is kept, as this is
314+
/// more useful for identifying the file)
315+
/// - `=` - custom chunk name (when truncation is needed, the beginning of the name is kept)
309316
pub fn set_name(mut self, name: impl Into<String>) -> Self {
310317
self.name = name.into();
311318
self

0 commit comments

Comments
 (0)