Paths
๊ฒฝ๋ก๋ ์๋์ ๊ฐ์ด ๊ตฌ๋ถํฉ๋๋ค:
- ์๋๊ฒฝ๋ก
foo
๋๋self::foo
๋foo
๋ชจ๋ ์์์ ํ์ฌ ๋ชจ๋์ ๊ฐ๋ฆฌํต๋๋ค.super::foo
๋foo
๋ชจ๋์ ๋ถ๋ชจ ๋ชจ๋์ ๊ฐ๋ฆฌํต๋๋ค.
- ์ ๋ ๊ฒฝ๋ก
crate::foo
๋ ํ์ฌ ํฌ๋ ์ดํธ ๋ฃจํธ์ ์๋foo
๋ฅผ ๊ฐ๋ฆฌํต๋๋ค.bar::foo
๋bar
ํฌ๋ ์ดํธ ์์ ์๋foo
๋ฅผ ๊ฐ๋ฆฌํต๋๋ค.
Paths are resolved as follows:
As a relative path:
foo
orself::foo
refers tofoo
in the current module,super::foo
refers tofoo
in the parent module.As an absolute path:
crate::foo
refers tofoo
in the root of the current crate,bar::foo
refers tofoo
in thebar
crate.
์ญ์ฃผ
- crate: ๋ฌ์คํธ์ ๊ธฐ๋ณธ ํจํค์ง ํน์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋จ์์ ๋๋ค. std๋ฅผ ๊ธฐ๋ณธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ / ๊ธฐ๋ณธ ํฌ๋ ์ดํธ ๋ผ๊ณ ํฉ๋๋ค.