Skip to content

Commit

Permalink
πŸ“ƒ docs(std): Resolve example
Browse files Browse the repository at this point in the history
`must_use` has its own example while `observes` and `required` have their respective example
  • Loading branch information
Midnightific committed Jan 25, 2024
1 parent b7c2350 commit 607ca21
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions docs/src/usage/std.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ This field is used for allowing smarter introspection of how the argument given
- "read" - This argument is only read from. Currently unused.
- "write" - This argument is only written to. Used by `unused_variable` to assist in detecting a variable only being written to, even if passed into a function.

Example:
```yml
table.insert:
args:
- type: table
observes: write # This way, `table.insert(x, 1)` doesn't count as a read to `x`
- type: any
- required: false
type: any
```
#### "must_use"
This field is used for checking if the return value of a function is used.
Expand All @@ -78,10 +89,10 @@ Example:
table.find:
args:
- type: table
observes: read # The table is only read from
required: true # The table to index is a required argument
observes: read
required: true
- type: any
required: true # The value to find is a required argument
required: true
must_use: true # The return value of this function must be used
```

Expand Down

0 comments on commit 607ca21

Please sign in to comment.