Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nanguage committed Feb 22, 2023
1 parent 21111ea commit 107516a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ def print_person(name: str, age: Val(int, [0, 120])):
print(f"{name} is {age} years old.")
```

You can also mark arguments using decorators in [`funcdesc`](https://github.com/Nanguage/funcdesc):

```Python
from oneface import one
from funcdesc import mark_input

@one
@mark_input("age", range=[0, 120])
def print_person(name: str, age: int):
print(f"{name} is {age} years old.")

```

This code achieves the same effect as the previous example, and you can refer to the [`funcdesc`](https://github.com/Nanguage/funcdesc) for more information about the `mark_input` decorator.


## Type and range checking

Functions decorated with `one` will automatically check the type and range of input parameters:
Expand Down

0 comments on commit 107516a

Please sign in to comment.