Skip to content

Commit

Permalink
Standard and core library inline documentation (#4830)
Browse files Browse the repository at this point in the history
## Description
Standardized documentation for the standard library and the core
library. Following the inline documentation standard (src-2)

Closes #4812

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.

---------

Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com>
Co-authored-by: bitzoic <bitzoic.eth@gmail.com>
Co-authored-by: JoshuaBatty <joshpbatty@gmail.com>
Co-authored-by: K1-R1 <77465250+K1-R1@users.noreply.github.com>
  • Loading branch information
5 people authored Aug 22, 2023
1 parent 7629126 commit 149b657
Show file tree
Hide file tree
Showing 51 changed files with 5,398 additions and 941 deletions.
19 changes: 16 additions & 3 deletions sway-lib-core/src/never.sw
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ use ::ops::{Eq, Not, Ord};

/// `Never` represents the type of computations which never resolve to any value at all.
///
/// # Additional Information
///
/// `break`, `continue` and `return` expressions also have type `Never`. For example we are allowed to
/// write:
///
/// ```
/// ```sway
/// let x: Never = {
/// return 123
/// };
Expand All @@ -20,7 +22,7 @@ use ::ops::{Eq, Not, Ord};
///
/// A more realistic usage of `Never` is in this code:
///
/// ```
/// ```sway
/// let num: u32 = match get_a_number() {
/// Some(num) => num,
/// None => break,
Expand All @@ -33,13 +35,24 @@ use ::ops::{Eq, Not, Ord};
///
/// Note that `Never` type coerces into any other type, another example of this would be:
///
/// ```
/// ```sway
/// let x: u32 = {
/// return 123
/// };
/// ```
///
/// Regardless of the type of `x`, the return block of type `Never` will always coerce into `x` type.
///
/// # Examples
///
/// ```sway
/// fn foo() {
/// let num: u64 = match Option::None::<u64> {
/// Some(num) => num,
/// None => return,
/// };
/// }
/// ```
pub enum Never {}

impl Not for Never {
Expand Down
Loading

0 comments on commit 149b657

Please sign in to comment.