mirror of
https://github.com/darkicewolf50/RustBrock.git
synced 2025-07-07 03:27:13 -06:00
finished ch7.3
This commit is contained in:
11
Paths.md
11
Paths.md
@ -64,3 +64,14 @@ can be called by the relative path ``front_of_house::hosting::add_to_waitlist();
|
||||
the public API that is determined by the developer is the contract with the users through other crates.
|
||||
There are many considerations to your public api to make it easier for people to depend on your crate
|
||||
These details and considerations are more concretely outlined in the [The Rust API Guidelines](https://rust-lang.github.io/api-guidelines/)
|
||||
|
||||
## Starting Relative Paths with super
|
||||
can contract relative paths starting at the parent rather than the root of the crate
|
||||
|
||||
This is done by using the ``super`` keyword at the start of the path it is equivalent to the ``..`` syntax
|
||||
useful for accessing items that we know are in the parent module which can make rearranging the module tree easier when the module is closely related to the parent but may be moved in the future
|
||||
|
||||
```rust
|
||||
super::deliver_order();
|
||||
```
|
||||
deliver order now can be located else where in the parent module and not forced to be in the child module
|
||||
|
Reference in New Issue
Block a user