Skip to content

Commit 8e8161e

Browse files
committed
doc: Update
1 parent 3a5160a commit 8e8161e

File tree

10 files changed

+27
-14
lines changed

10 files changed

+27
-14
lines changed

book/src/libs/array/array.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Array
22
***
3-
`Arr` (Array) is a zero cost extension type of `List`, where the `List` is treated as non-growable. This is useful for correctly handling lists where growable is false and const lists - as these types of lists are treated the same in the regular Dart type system, which may lead to errors. With `Arr`, type intent is clear for maintainers and developers are able think about code performance more critically.
3+
[Arr](https://pub.dev/documentation/rust/latest/rust/Arr-extension-type.html) (Array) is a zero cost extension type of `List`, where the `List` is treated as non-growable. This is useful for correctly handling lists where growable is false and const lists - as these types of lists are treated the same in the regular Dart type system, which may lead to errors. With `Arr`, type intent is clear for maintainers and developers are able think about code performance more critically.
44
```dart
55
Arr<int?> array = Arr(null, 10);
66
```

book/src/libs/cell/cell.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Cell
22
***
3-
Cell is library of useful wrappers types (cells) - [pub.dev](https://pub.dev/documentation/rust/latest/cell/cell-library.html).
3+
Cell is library of useful wrappers types (cells).
44

5-
[Cell](#cell) - A wrapper with interior mutability.
5+
[Cell](https://pub.dev/documentation/rust/latest/rust/Cell-class.html) - A wrapper with interior mutability.
66

7-
[OnceCell](#oncecell) - A cell which can be written to only once.
7+
[OnceCell](https://pub.dev/documentation/rust/latest/rust/OnceCell-class.html) - A cell which can be written to only once.
88

9-
[LazyCell](#lazycell) - A value which is initialized on the first access.
9+
[LazyCell](https://pub.dev/documentation/rust/latest/rust/LazyCell-class.html) - A value which is initialized on the first access.
1010

11-
[LazyCellAsync](#lazycellasync) - A value which is asynchronously initialized on the first access.
11+
[LazyCellAsync](https://pub.dev/documentation/rust/latest/rust/LazyCellAsync-class.html) - A value which is asynchronously initialized on the first access.
1212

1313

1414
## Cell

book/src/libs/env/env.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Env
22

3-
Env introduces `Env` for handling the environment. It works like `Platform`,
3+
Env introduces [Env](https://pub.dev/documentation/rust/latest/rust/Env-class.html) for handling the environment. It works like `Platform`,
44
except it is cross-platform (also works on web), since it is independent of `dart:io`, and has additional methods.
55

66
```dart

book/src/libs/fs/fs.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Fs
22

3-
Fs introduces `Fs`, a container of static methods for working with the file system in a safe manner.
3+
Fs introduces [Fs](https://pub.dev/documentation/rust/latest/rust/Fs-class.html) and
4+
[OpenOptions](https://pub.dev/documentation/rust/latest/rust/OpenOptions-class.html).
5+
`Fs` is a container of static methods for working with the file system in a safe manner.
46
`Fs` combines many of the functionalities in `File`/`Directory`/`Link`/`FileStat`/`FileSystemEntity`
57
into one location and will never throw an exception. Instead of using instances of the previous
68
entities, `Fs` works only on paths.
@@ -18,4 +20,15 @@ catch (e) {
1820
// handle
1921
}
2022
// handle
23+
```
24+
`OpenOptions` is a more extensive builder pattern for opening files in place of `File(..).open(mode)`
25+
```dart
26+
OpenOptions options = Options()
27+
..append(true)
28+
..create(true)
29+
..createNew(true)
30+
..read(true)
31+
..truncate(true)
32+
..write(true)
33+
RandomAccessFile randomAccessFile = options.openSync("path/to/file".asPath()).unwrap();
2134
```

book/src/libs/iter/iter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Iter
22
***
33
A Rust `Iterator` is analogous to the union of a Dart `Iterable` and `Iterator`. Since Dart already has an `Iterator` class, to avoid confusion,
4-
the Dart implementation of the Rust iterator is `Iter`. `Iter`
4+
the Dart implementation of the Rust iterator is [Iter](https://pub.dev/documentation/rust/latest/rust/Iter-class.html). `Iter`
55
makes working with collections of `rust` types and regular Dart types a breeze. e.g.
66

77
```dart

book/src/libs/ops/ops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## RangeBounds
66

7-
`RangeBounds` works the same as Rust's `RangeBounds` (usually seen as syntactic sugar e.g. `1..=3`)
7+
[RangeBounds](https://pub.dev/documentation/rust/latest/rust/RangeBounds-class.html) works the same as Rust's `RangeBounds` (usually seen as syntactic sugar e.g. `1..=3`)
88
They have two uses:
99
1. `RangeBounds` can be used to get a `Slice` of an `Arr`, `Slice`, or `List`.
1010
```dart

book/src/libs/option/option.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Option
22
***
3-
`Option` represents the union of two types - `Some<T>` and `None`.
3+
[Option](https://pub.dev/documentation/rust/latest/rust/Option-class.html) represents the union of two types - `Some<T>` and `None`.
44

55
`Option` is easy to declare and translate back and forth between nullable types.
66
```dart

book/src/libs/panic/panic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Panic
22
***
3-
As with `Error` in Dart Core, `Panic` represents a state that should never happen and thus should never be caught.
3+
As with `Error` in Dart Core, [Panic](https://pub.dev/documentation/rust/latest/rust/Panic-class.html) represents a state that should never happen and thus should never be caught.
44
Rust vs Dart Error handling terminology:
55

66
| Dart Exception Type | Equivalent in Rust |

book/src/libs/result/result.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Result
22
***
3-
`Result<T, E>` is the type used for returning and propagating errors. It is an alternative to throwing exceptions. It is a sealed type with the variants, `Ok(T)`, representing success and containing a value, and `Err(E)`, representing error and containing an error value.
3+
[Result<T, E>](https://pub.dev/documentation/rust/latest/rust/Result-class.html) is the type used for returning and propagating errors. It is an alternative to throwing exceptions. It is a sealed type with the variants, `Ok(T)`, representing success and containing a value, and `Err(E)`, representing error and containing an error value.
44

55
To better understand the motivation around the `Result` type refer to this [article](https://mcmah309.github.io/#/blog/the_result_type_in_dart).
66

book/src/libs/slice/slice.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Slice
22
***
3-
A `Slice` is a contiguous sequence of elements in a `List`. Slices are a view into a list without allocating and copying to a new list,
3+
A [Slice](https://pub.dev/documentation/rust/latest/rust/Slice-class.html) is a contiguous sequence of elements in a `List`. Slices are a view into a list without allocating and copying to a new list,
44
thus slices are more efficient than creating a sub-list, but they do not own their own data. That means shrinking the original list can cause the slices range to become invalid, which may cause an exception.
55

66
`Slice` also has a lot of efficient methods for in-place mutation within and between slices. e.g.

0 commit comments

Comments
 (0)